Reputation: 347
I am using Google Tag Manager for my website and I want to fire some codes in transaction complete page based on the source that visitor arrived. And my IBE is in a different domain.
Say the website is website.com and IBE is ibe.com,
So, I created a cookie and inserted the source as cookie value. As long as visitor is on a website.com, I have the 1st party cookie value defined as "source". But the moment visitor goes to the ibe.com, I am unable to access my source cookie.
Is there any way to pass the source value (gtm variable value) to the other domain (ibe.com) when the visitor goes to the ibe.com?
Any help regarding this would be highly appreciated.
Upvotes: 0
Views: 1590
Reputation: 32760
I can think at least if two ways.
The first would be to do what Google Analytics does for cross domain tracking and pass on the value via the URL. For that you need a decorator function.
So if somebody clicks a link or submits a form you intercept that via Javascript from a custom HTML tag. You add your value to the link target or form action, then you redirect or submit from within your function. On the receiving end you read the value from the url parameter.
Another method would use an iframe and the postMessage interface. You would need to reference the iframe in both sites, it would serve basically as a message container.
Postmessage allows cross-domain-configuration between frames. You would use this to send a message to the iframe and have it stored, in a cookie or local storage. On the receiving page you would use postMessage to poll the iframe for stored messages.
There are other possibilities, but nothing more reliable or elegant; if you need to transfer a single value you should probably go with the URL parameter.
Upvotes: 1