Enable GTM Integration in Chargebee.js

Modified on: Tue, 31 Aug, 2021 at 6:02 PM

Note: GTM integration is for recording customer interactions with Chargebee checkout and portal. Backend operations such as subscription renewals do not trigger any events to GTM. 

You may integrate Chargebee with GTM via drop-in script or API.

A. Using Drop-in Script

Enable the data-cb-gtm-enabled attribute to true when invoking Chargebee.js in the page headers of your site.

<script src="https://js.chargebee.com/v2/chargebee.js"
data-cb-site="you-chargebee-subdomain" data-cb-gtm-enabled="true">
</script>

Note: Replace your-chargebee-subdomain in the code snippets on this page with your Chargebee site subdomain names.
Eg. If your Chargebee site is bigshopper-test.chargebee.com, then replace your-chargebee-subdomain with bigshopper-test.

B. Using API

Pass the enableGTMTracking parameter as true when initializing the Chargebee instance.

var chargebeeInstance = Chargebee.init({
    site: "your-chargebee-subdomain",
    enableGTMTracking: true
});

Other important Links

M
Monica is the author of this solution article.

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.
×