Campaign CAE Integration

Last updated 3 minutes ago

Learn how to integrate Campaigns into the CAE.

This page gives you a short overview on how to integrate CoreMedia Campaigns into the CAE.

The CAE fetches and renders campaign data on content pages, category pages and product details pages.


  • A CoreMedia Content Cloud account with CoreMedia Campaigns enabled.

  • Access to the Campaign App via Studio.

  • Valid access tokens for the Campaigns GraphQL Delivery API.

  • A CoreMedia Blueprint workspace version 2404 or higher.


The Campaign CAE Integration consists of two parts:

  • a plugin for the CAE

  • blueprint extensions for the CAE.

The plugin is responsible for fetching the campaign data from the Campaign Delivery GraphQL API. The plugin is not part of the blueprint and can be updated independently.

The blueprint extensions are responsible for rendering campaign data into the page. The data is fetched from the Campaign Delivery Service per page impression with the given information of the current page, category or product. Once the slot assignment data is loaded from the Campaign Delivery Service it is rendered together with the page grid placements. This is achieved through a view hook integration for page grid placements. The CAE tries to render suitable campaign slot assignments for each placement on the page.

The freemarker templates for the rendering of campaign content are part of the blueprint extension and the frontend-workspace.


Enable the Campaign Integration

To enable the integration in the CAE you need to:

  • enable and configure the blueprint extensions campaigns-cae and lc-campaigns-cae that are already part of the blueprint workspace

  • load the campaign.cae-plugin into your CAE

Extend your CAE configuration:

# Enables the Campaign CAE Integration

# The access token for the Campaign Delivery API.
# Configure the preview access token in the preview CAE and the live access token in the live CAE<your-campaign-delivery-access-token>

Load the campaign.cae-plugin into your CAE:

You can find the latest plugin releases here: campaign.cae-plugin releases. For further information on how to add plugins to your CAE please refer to the CAE documentation. (local development or Plugin Descriptors and Bundled Plugins)

Cache configuration (optional)

To avoid unnecessary requests to the Campaign Delivery API the CAE caches the campaign data. The cache is configured with the following configuration:

# Cache campaign data for one minute

The default value is 10 seconds in the preview cae and 300 seconds in the live cae.

Check if the integration is working

  • Open a page in the CAE.

  • Create a new campaign in the Studio Campaign App for your site and the given page.

  • Add a channel to the campaign (e.g. homepage).

  • Add a slot assignment to the channel (e.g. banner). Make sure that the placement banner is rendered on the page.

  • Reload the page. The campaign should be rendered on the page.


CoreMedia provides a default template for the rendering of campaign content: CampaignSlot.ftl. It is part of the blueprint extension campaigns-cae.

Customizing the Campaigns rendering

Rendering of campaigns is achieved by a view hook integration for page grid placements. In the template PageGridPlacement.ftl the view hook is called:

<@cm.hook id=bp.viewHookEventNames.VIEW_HOOK_PLACEMENT />

This triggers the CampaignPlacementViewHookEventListener that is part of the blueprint extension. The view hook listener tries to find data for the current placement name in the campaign data. The campaign data has been fetched earlier and stored into the request via handler interceptors that are also part of the blueprint extension.

If suitable data is found the view hook listener renders the data with the template CampaignSlot.ftl. The default render view for campaign slot assignments is asTeaser if the view has not been set in the view hook macro.

This can be customized by adding a view name as follows [source,freemarker

<@cm.hook id=bp.viewHookEventNames.VIEW_HOOK_PLACEMENT params={"view": "myView"} />

If you want to change the appearance of the campaign slot assignments, you can do so by changing the CampaignSlot.ftl template or adding a custom template with the same name to your own theme.

Copyright © 2024 CoreMedia GmbH, CoreMedia Corporation. All Rights Reserved.