Setting up Google Analytics if I’m using Chargebee Checkout (V3)

Modified on: Fri, 24 Mar, 2023 at 4:11 PM

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.

 

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.


Did you find it helpful? Yes No

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