Setting up Google Analytics for Chargebee Checkout (V3)


To set this up, you need to:

  1. Setup Google Analytics Account  

  2. Enable Google Analytics in Chargebee


Step 1: Setup Google Analytics Account  

  • Sign up for a Google Analytics Account

  • After filling in the information, click Get Tracking ID 

  • The Tracking Info page will give you the code you need to integrate to your business website. Here’s how it’s done:

    • Locate the header section in your webpage code (<head> </head> tags)

    • Copy the pixel code from the Google Analytics Tracking Info page and paste it within the header tags

    • Paste the tracking code where you use Chargebee Checkout

    • Chargebee supports both ga and gtag version of tracking code


Step 2: Enable Google Analytics in Chargebee


In Checkout v3, you can enable GA following one of these approaches:


1. If you are using Drop-in Checkout

  • Go to Setting → Configure Chargebee -→ Checkout & Self Serve Portal → Advanced Settings

  • Add your site domain in the whitelisted domains section

  • In drop-in header script, include the data-cb-ga-enabled="true" attribute 


Sample:

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

</script>


2. If you have integrated via Chargebee Checkout API

  • Go to Setting → Checkout & Self Serve Portal → Advanced Settings

  • Add your site domain in the whitelisted domains section

  • While initializing Chargebee instance, pass the enableGATracking parameter with value as true


Sample:

$( document ).ready(function() {

  var chargebeeInstance = Chargebee.init({

    site: "your-site",

    enableGATracking: true

  });

});


Feel free to contact Chargebee support if you need further clarification.