# Google Analytics Tracking

Follow the below steps to integrate Google analytics with Chargebee checkout (v3 version).

# Step 1: Getting the tracking code from Google Analytics

  • Log in to your Google Analytics Account
  • Click Get Tracking ID .The Tracking Info page will give you the code you need to integrate to your business website.

Note :Chargebee supports both ga and gtag version of tracking code.

# Step 2: Enable the tracking code on your website pages.

Here’s how it’s done:

  • Locate the header section (head tags) in your website pages.
  • Copy the tracking code from Google and paste it within the header section in your website pages.

# Step 3: Whitelist your domain in Chargebee

  • Go to Setting → Configure Chargebee -→ Checkout & Self Serve Portal → Advanced Settings
  • Add your site domain in the whitelisted domains section

# Step 4: Enable Google Analytics in Chargebee Checkout

Enable Google Analytics in checkout based on your integration mode.

# Drop-in Checkout Integration

If you have integrated checkout using Drop-in Script mode, then include the data-cb-ga-enabled="true" attribute in the included header script.

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

# API

If you have integrated checkout using API mode, then while initializing Chargebee instance, pass the enableGATracking parameter with value as true


$( document ).ready(function() {
  var cbInstance = Chargebee.init({
    site: "your-site",
    enableGATracking: true
  });
});

1
2
3
4
5
6
7
8