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

Integration

See the full flow of a CG Elements integration, from offer to booking.

Read this page before you write code.

Flow

Steps

1

Create the offer

Your backend calls Create Offer. The response includes products, content, and presentation.

2

Send the response to the browser

Your backend sends the response to the browser.

3

Register the SDK

Your page registers the SDK once with registerElements().

4

Render the offer

Your page calls render(response) on the instance that getElement() returns.

5

The panel shows

The SDK shows the panel. The ready event fires.

6

The customer chooses

The customer chooses an option. The change event fires with the selection.

7

Confirm the offer

Your backend calls Confirm Offer with the selected quote IDs.

Concepts

Term
Meaning

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

The SDK does not do these things. Your backend and your checkout do them.

  • It does not create, confirm, modify, or cancel offers.

  • It does not take payment.

  • It does not render on the server.

  • It does not store customer data.

  • It does not make network calls for offer data, and it holds no credentials.

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?