Last update: Dec, 2025
Overview
This guide explains how to integrate Kayzen's KTag using Google Tag Manager (GTM). By implementing Kayzen's KTag inside GTM, you can trigger custom events such as:
Page views
Button clicks
Form submissions
Add-to-cart actions
Product Purchase
Any other interaction available through GTM triggers
These events become available for campaign optimisation and reporting inside Kayzen.
Prerequisites
Before starting, ensure the following:
✔ Access Requirements
You must have the ability to:
Create Tags
Create Triggers
Publish changes in your GTM container
✔ Kayzen Event API Key
You will need your unique Event API key from Kayzen.
Refer to: Obtaining Kayzen Event API Key
Google Tag Manager settings
You will need to implement the following settings in your GTM for your website where you want to track the events. You need to implement all these below settings for every event you want to send to Kayzen.
Implementation Steps
Step 1: Create a Kayzen Initialization Tag(Required)
This tag initializes the Kayzen KTag script on your website through GTM.
Go to Add a New Tag
Tag Configuration:
Tag Name:
KTag - InitializerTag Type: Custom HTML
Trigger Configuration :
Trigger Type : Page View
This trigger fires on : All Page views
Code Snippet:
Below Code snippet needs to be pasted under html option
<!-- Kayzen Head Events Tag Start -->
<script>
window.ktag = function() {
window.ktag.q.push(arguments);
};
window.ktag.q = [];
var script = document.createElement('script');
script.async = true;
script.src = 'https://webevents.kayzen.io/kayzenevents.js';
script.dataset.apiKey = 'YOUR_KAYZEN_API_KEY';
script.dataset.integratedVia = 'GTM';
document.head.appendChild(script);
</script>
<!-- Kayzen Head Events Tag End →
⚠️ Important
Replace <YOUR_KAYZEN_API_KEY> with the Event API key of your website object from Kayzen UI
Instead of script.src = 'https://webevents.kayzen.io/kayzenevents.js';
you can use below endpoint for Whitelable setup (https://webevents.eventstracker.io/webevents.js)
💡Why this tag is required?
This snippet loads the Kayzen KTag library on every page, enabling all subsequent event tags to work.
Click 'Save' to proceed with these changes.
Step 2: Create Event Tracking Tags
Once initialisation is complete, you can define additional tags to capture specific user interactions, such as button clicks, form submissions or page visits.
Example A: Page View Event
Tag Name: Page View
Tag Type: Custom HTML
Code Snippet:
<script>
ktag('page_view', true);
</script>
Trigger Configuration :
Trigger Type : Page View
This trigger fires on : All Page views (fires when a page is loaded)
Click 'Save' to proceed with these changes.
Example B: Add_to_cart
Tag Name: Add To Cart
Tag Type: Custom HTML
<script>
ktag('Add_to_cart',true);
</script>
Trigger name : Add To Cart Button
With these steps you have setup ktag and Events on GTM, next we will move on to setup the Kayzen URL
💡Tip: You may create multiple custom events depending on your site
e.g., Lead, Subscribe, ViewProduct, purchase etc.
Using multiple events is recommended, as it provides stronger signals and improves the learning of our CPA algorithm.
Kayzen Click URL:
Click URL should have a mandatory Kayzen macro &bid_id={CONVERSION_ID} (if you want to track other details on Kayzen, you can refer to macro tracking article).
Sample click URL: https://kayzen.io/?utm_source=Kayzen&utm_medium=display&utm_campaign=Test&bid_id={CONVERSION_ID}
Testing & Validation
Before publishing in GTM:
1. Use GTM Preview Mode
Click Preview
Navigate through your website
Confirm your tags fire correctly:
KTag - InitializerAll custom event tags
2. Use Browser Developer Tools
In Network, check for calls to:
https://api-events.kayzen.io
If they appear during your interactions, the integration is working.
3. After successful testing
Click Submit → Publish to activate your GTM container.
Troubleshooting
Event not appearing in Kayzen?
Check if events are populating or not in your advertiser setting
Check the following:
✔ API Key
Ensure the Event API key is valid and correctly inserted in GTM
✔ Tag order
The Initialiser must load before any event tag.
Please ensure that it fires on All Pages
✔ Console Logs
Look for network errors that may block installation in Developer Tool
✔ Trigger Issues
Event tags must be tied to correct GTM triggers
✔ Ad Click Tracking (Important for Attribution)
Kayzen Click URLs must include the mandatory macro: &bid_id={CONVERSION_ID}
This ensures conversions properly map to campaigns inside Kayzen.
Incase of any issues reachout to Product Support
