Custom linker name for iframe cross domain tracking

Ecommerce platforms like Eventbrite requires custom linker name for cross-domain tracking to get working, as most of the user’s iframes for ticket selection it becomes pretty hard to do things easily, but if you use GTM, things work well in just a few steps with a hitCallback that executes a customJs variable when GA loads.

Below is the CustomJS to be used in GTM.

Normal linker name in Google Analytics cross-domain tracking is _ga while for Eventbrite it requires custom name – _eboga

If all is well you will get this:- custom linker name with GA client id decorated over the iframe source link.

Obtaining analytics clientId directly from cookie variable

Ever since cookie variable was introduced, obtaining clientId  became pretty easy . In this method, we will use the Cookie Variable in GTM.  ( old post for extracting clientId with CutsomJs)

So, let’s start with the basics that, the  “_ga” is the name of GA cookie that stores the client id.



now we will go ahead and create a new variable of type “1st Party Cookie”  and at variable part give the name of cookie – “_ga”. This variable will extract the value of the cookie with name “_ga” .



Now, as usual, debugging / previewing  the job.


Getting rid of GTM host events in Mixpanel

Anyone who have played around with Mixpanel implementation with GTM would have seen BOTs triggering events like below.

mixpanel gtm

To solve the issue, we would just need some JavaScript code. But let’s see the logic before discussing that, you will notice that the Current URL of GTM generated events will be always on domain , so the best thing to do is to block events from domain / host

For this, we will enclose the GTM MIXPANEL EVENT CUSTOM HTML tag in a JavaScript if statement which will check the host of the domain and execute the code.

Above, code will check if the document location and on the mismatch with it would execute the Mixpanel event. Thus filtering out all the GTM generated events.

Obtaining Google Analytics ClientID with Tag Manager

Anyone dealing with Measurement Protocols / CRMs will always need ClientID for tasks like sending offline transactions, managing leads/ refunds etc.. so that an exact user is matched with associated hit /record.

Searching the web I found 3 ways to fetch the client using GTM, both have same procedure but different CustomJs variable.

Continue Reading

Extracting URL Parameter with GTM and using it as a variable

Update :- now we can get a direct PRE-DEFINED URL VARIABLE as below.  With this, we just have to create a new variable type of URL and component type Query. Query Key here will the name of parameter in the URL.

For above URL the setup extract value of << parm >> will be like below:













URL parameter extraction  is very useful in cases when there are restrictions to code directly in the website/application. This implementation will basically need a “Custom HTML” tag and a “Custom JS” variable. So let’s start off.

First make a CUSTOM HTML tag

And make a trigger such that it fires on your target page/s.  This script will extract the URL parameters from URL.

Now create a CUSTOM JS variable:

This will return the URL PARAMETER named “url_parameter”  from CUSTOM HTML tag as VARIABLE and can be use to pass through other tags like conversion tags.