For the complete documentation index, see llms.txt. This page is also available as Markdown.

Multiple Placements

Show more than one offer panel on a page and address each one.

Name each placement

Add the data-presentation-ref attribute to each <cg-elements> element. Use the value of presentation.ref from the offer response.

<cg-elements data-presentation-ref="checkout-primary"></cg-elements>
<cg-elements data-presentation-ref="checkout-secondary"></cg-elements>

Address each placement

Pass the same value to getElement().

const primary = getElement('checkout-primary');
const secondary = getElement('checkout-secondary');

primary.render(primaryOfferResponse);
secondary.render(secondaryOfferResponse);

Each placement has its own handlers, selection, and state. A call on one placement never changes another.

Single placement

If the page has one panel, omit the attribute and omit the argument.

<cg-elements></cg-elements>
const cgElement = getElement();

Register once

Call registerElements() one time for the whole page. All placements share its settings.

Last updated

Was this helpful?