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
- The list of events passed to GA/GTM.
- Limitations of the GTM integration.
- Prerequisites for GTM integration.