1. Home
  2. Custom Scripts & Codes
  3. Tracking with Google Analytics – using Google Tag Manager/GTM

Tracking with Google Analytics – using Google Tag Manager/GTM

Note: This is the recommended way of passing data through to Google Analytics for all new users. Click here to learn about other options.

Using Google Tag Manager allows you to collect data into Google Analytics, and also lets you easily connect other services through GTM.

You can configure Google Tag Manager manually, however we recommend using our easy container builder to download a file which can be imported, and sets up all of the required tags, triggers and variables for you to use as a starting point for your tracking.

Firstly, you will need to create a new Google Analytics 4 property. Take note of your measurement ID (example: G-XYZABC123) as we will need this later.

Next, create a new Google Tag Manager account – enter an account name, your country, a name for the container, and select ‘Web’ as the target platform.

Review the terms and accept them to continue.

Close the popup window which gives you some code to place on your web pages – with ThriveCart, you do not need to do this.

Go to the ‘Admin’ tab at the top of the screen. From here, copy the container ID (example: GTM-ABC123) displayed at the top of the screen.

Head to ThriveCart, and in your product settings, go to Checkout -> Tracking, and enable the new ‘GTM’ tracking integration. Click the button to ‘Get container file’.

In the first field, provide your container ID which we just copied (example: GTM-ABC123).

In the second field, provide the measurement ID from Google Analytics 4 (example: G-XYZABC123) that we noted earlier, and click to continue.

On the second screen, you will see your template file. Click the button to download this as a JSON file. The field in ThriveCart will pre-fill with your provided container ID, so you can save your product’s settings.

Head back over to Google Tag Manager, and from the Admin screen, click on the ‘Import container’ link.

Select the JSON file you downloaded, choose to new a ‘New’ workspace and give it a name, and click the blue ‘Confirm’ button.

You should see 3 new tags, 2 new triggers, and 6 new variables in the breakdown of what will be imported. Click the ‘Confirm’ button.

Important: you must publish the changes to your container or they will not become active. Click the blue ‘Submit’ button in the top-right of the screen, provide a name for the changes (e.g. ‘ThriveCart integration’), and publish the changes.

As customers land on your cart pages, your new GTM integration will pass data into your Google Analytics 4 streams.

To use the same container with other products, you do not need to click the ‘Get container file’ button in ThriveCart, and you can instead simply enter the container ID into the field and save your product’s settings.

Updated on June 14, 2023

Was this article helpful?

Related Articles