Blueprint Developer Manual / Version 2512.1
Table Of ContentsThe frontend theme can be extended with a brick that acts on the callbacks received from the personalization provider. The brick is responsible for loading variant fragments and displaying the baseline content if no variant is triggered. The provider's script tag is independently included in the adapter CAE extensions.
Together with a small piece of JavaScript proxy code injected into the HTML head by the CAE extension, the brick provides the callback functions called from the third-party service if a variant or segment is to be displayed and replaces the default content fragment with the variant loaded via AJAX.
The frontend code adds the object cm_p13n to the window object providing the following methods:
pushVariant(variantId:String)Activates the variant with the given ID.
pushSegment(segmentName:String)Activates the segment with the given name.
completed(providerId)Called when the third-party service is finished and displays the baseline for all fragments where no variant or segment is active.
In the Studio preview, the CAE passes the variants and segments selected in the preview to the
page by calling these methods. This client-side code can be switched off by setting
cae.variant.enabled=false in the application.properties of the CAE.
Note that the third-party adapter extensions require the cm_p13n object.
Adding the brick to the theme
Add the brick p13n-dynamic-include as dependency to your theme (package.json).
pnpm add @coremedia/brick-p13n-dynamic-include


