Docs

Hosted Pages Articles & FAQ

enable, GTM, google, tag, manager

38989385

2021-08-31T12:32:13Z

2025-02-12T08:23:32Z

439

0

0

251810

Enable GTM Integration in Chargebee.js

Enable GTM Integration in Chargebee.js 

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 }); 
Google Universal Analytics is getting deprecated and will stop processing data on July 1, 2023. Google has introduced a new analytics engine Google Analytics 4 (GA4) that offers new and advanced features that can help you gain a deeper understanding of your website visitors' behavior, such as event tracking, machine learning, and cross-device tracking. With the new setup of GA4 and Chargebee-hosted pages it leverage the capabilities to analyze and optimize your website's performance, providing you with a competitive edge in the subscription business. 

If your site is configured with Google Universal Analytics version, then you can refer to this link to migrate to Google Analytics 4.

If you're using Google Tag Manager to connect to your Google Analytics 4, we recommend that you use this separate integrationand never both.

Other Important Links

Was this article helpful?
Loading…