Overview
The Twinalyze GTM integration works like this:- A Twinalyze account
- A Twinalyze project
- API Key and Public Key
- A Google Tag Manager account
- GTM container access
- Website code or admin access
Install Google Tag Manager
First, add the Google Tag Manager script to your website.Open your GTM container
Copy GTM install code
GTM-XXXXXXX. Google Tag Manager will show two code snippets.Add script in head
<head> tag.Add noscript in body
<body> tag.Publish website changes
GTM-XXXXXXX with your actual Google Tag Manager container ID.Initialize Twinalyze SDK
After GTM is installed, create the Twinalyze initialization tag.Create new tag
Tags and click New.Choose Twinalyze template
Twinalyze Web Analytics SDK.Select Initialize SDK
Tag Type dropdown, select Initialize SDK.Add project details
API Key, Public key, and API Base URL.Enable tracking options
Add trigger
All Pages trigger.Save tag
Twinalyze - Initialize SDK and save it.API Key
API Key
Public key
Public key
API Base URL
API Base URL
Automatic tracking options
Automatic tracking options
Site Search Params
Site Search Params
File Download Extensions
File Download Extensions
Advanced - Debug Mode
Advanced - Debug Mode
Advanced - SDK Version and SDK URL
Advanced - SDK Version and SDK URL
1.0.19Track Custom Events
To track custom actions like add to cart, purchase, signup, or form submit, push an event into GTMdataLayer.
Example website code:
Create Data Layer Variables
Variables, create new Data Layer Variable entries, and use the exact keys from your dataLayer event.Create Custom Event Trigger
Triggers, create a Custom Event trigger, and enter the event name. For this example, use add_to_cart.Create Twinalyze event tag
Tags, create a new Twinalyze tag, select Track Event or your custom event option, and set event name as add_to_cart.Map event properties
Attach trigger
CE - add_to_cart, to the Twinalyze custom event tag.| Property name | GTM value |
|---|---|
| product_id | |
| product_name | |
| price | |
| currency | |
| quantity |
Test and Publish
Test your setup before publishing.Open GTM Preview Mode
Preview and connect your website.Check Initialize SDK tag
Twinalyze - Initialize SDK fires on page load.Check custom event
add_to_cart appears in GTM Preview Mode.Check event tag
Twinalyze - Add To Cart fires on the custom event.Check Twinalyze dashboard
Publish container
- GTM script is added to the website
- Twinalyze Initialize SDK tag is firing
- Initialize SDK trigger is set to All Pages
- API Key is correct
- Public key is correct
- API Base URL is correct
- Required automatic tracking options are enabled
- Data Layer Variables are created correctly
- Custom Event Trigger event name matches the dataLayer event
- Twinalyze custom event tag is firing
- Debug mode is disabled
- GTM container is published
- Events are visible in Twinalyze dashboard
Troubleshooting
GTM is not loading on website
GTM is not loading on website
<head> and the noscript should be immediately after <body>.Initialize SDK tag is not firing
Initialize SDK tag is not firing
All Pages.SDK is not loading
SDK is not loading
Custom event is not showing in GTM Preview Mode
Custom event is not showing in GTM Preview Mode
window.dataLayer. The pushed event name must match the Custom Event Trigger name.Event properties are empty
Event properties are empty
product_id, the Data Layer Variable Name must also be product_id.Events are not visible in Twinalyze
Events are not visible in Twinalyze
Duplicate events are coming
Duplicate events are coming