Integration
See the full flow of a CG Elements integration, from offer to booking.
Read this page before you write code.
Flow
Steps
Create the offer
Your backend calls Create Offer. The response includes products, content, and presentation.
Send the response to the browser
Your backend sends the response to the browser.
Register the SDK
Your page registers the SDK once with registerElements().
Render the offer
Your page calls render(response) on the instance that getElement() returns.
The panel shows
The SDK shows the panel. The ready event fires.
The customer chooses
The customer chooses an option. The change event fires with the selection.
Confirm the offer
Your backend calls Confirm Offer with the selected quote IDs.
Concepts
Offer response
The Create Offer response. It holds the quotes (products), the copy (content), the selection rules (product_rules), and the presentation field.
Presentation
The presentation field of the offer response. It names the layout and the theme. Cover Genius sets it for your offer. You do not edit it.
Placement
One <cg-elements> element on your page. Most pages have one placement. A page can have more than one. See Multiple Placements.
Selection
The option that the customer chooses. An option is an opt-in choice or the decline choice. The SDK reports the selection as option IDs and quote IDs.
Quote ID
The id of an entry in products[]. The change event returns quote IDs in selectedProductIDs. Use these IDs to confirm the offer.
What the SDK does not do
Environments
Set the environment option in registerElements() to production, uat, or develop. Use the value that matches the Offers API environment that your backend calls.
Requirements
A browser with custom elements and
<script type="module">support. Mobile WebViews and installed PWAs also work.An Offers API integration on your backend.
A presentation configured for your offer. Visit Your Program in our Partner Portal and request a change for your Offer Presentation.
Last updated
Was this helpful?

