Google Analytics & Tag Manager Setup Guide
Date Published
- Twitter
- Facebook
- LinkedIn
- Instagram
- Copy Link

Introduction
This setup sends data to GLP Winner's GA4 (Google Analytics) dashboard. This setup is ideal to get off the ground running if you have access to the GTM (Google Tag Manager) account but no access to either the code or the website builder.
Here's a quick Loom on a no-code way to track conversions with GTM & GA4. All of it can be done in your existing GTM accounts. This is a quick way to get some form of tracking set up before integrating via our integrations:
- Server side post back tracking
- Client side Javascript SDK
- Client side Javascript SDK & Google Tag Manager
- Google Tag Manager Integration
The following is a text version of the above Loom.
There are high level three steps to doing this:
- Create a Google Tag to send data over to GLP Winner’s GA4 Dashboard
- Create a Custom HTML Tag to store utm_source url parameter into a cookie
- Create a Google Analytics: GA4 Event Tag to track conversion events and send them to GLP Winner's GA4 dashboard
Tag 1: Create a Google Tag to send data over to GLP Winner’s GA4 Dashboard
Create a Google Tag for GLP Winner's Measurement ID: G-C8FCD1575R.
This tag should have the trigger Initialization - All Pages.
Tag 2: Create a Custom HTML Tag to store utm_source url parameter into a cookie
- Create a Variable URL - utm_source that will contain the value from query parameter utm_source:
- Name: URL - utm_source
- Variable Type: URL
- Component Type: Query
- Query Key: utm_source
- Create a Variable Cookie - utm_source that will read from the cookie:
- Name: Cookie - utm_source
- Variable Type: 1st Party Cookie
- Cookie Name: gtm_utm_source
- Create a Tag cHTML - Set utm_source cookie
- Name: cHTML - Set utm_source cookie
- Tag Type: Custom HTML
- HTML: <script>
(function(){
var cookieName = "gtm_utm_source";
var cookieValue = "{{URL - utm_source}}";
if (cookieValue && cookieValue !== "undefined") {
var expirationTime = 2592000; // 30 days in seconds
expirationTime = expirationTime * 1000;
var date = new Date();
var dateTimeNow = date.getTime();
date.setTime(dateTimeNow + expirationTime);
var expirationTime = date.toUTCString();
document.cookie = cookieName+"="+cookieValue+"; expires="+expirationTime+"; path=/; domain=." + location.hostname.replace(/^www\./i, "");
}
})();
</script> - Firing Triggers:
- Name: Pageview - url utm_source glpwinner
- Trigger Type: Page View
- This trigger fires on: Some Page Views
- {{URL - utm_source}} contains glpwinner
- Note the value can be something like glp_winner_${providerName}
Tag 3: Create a Google Analytics: GA4 Event Tag to track conversion events and send them to GLP Winner's GA4 dashboard.
You would change the name and trigger to fit what the definition of a conversion is. This depends on your funnel. In the example below it's the /confirmation Page View.
- Name: GLPW Affiliate - Example Convert User
- Tag Type: Google Analytics: GA4 Event
- Measurement ID: G-C8FCD1575R
- Event Parameter: utm_source
- Value: {{Cookie - utm_source}}
- Firing Triggers:
- Pageview - Order Confirmation Page
- Trigger Type: Page View
- This trigger fires on: Some Page Views
- {{Page Path}} equals /confirmation
Make sure to preview and save changes.
Keep Reading
Curated by
