AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

3.4K members online now
3.4K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
Guide Me

Tracking users through iFrame elements

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

We have implemented UA with GTM. It's working. On some pages, we have iFrame scripts embedded which include their own UA tracking code. We need the UA tracking to remain in the iFrame elements because they provide useful data such as event tracking. We are using the same property ID throughout.


The issue is that one user is now counted twice: once from the page where GTM is implemented and once from the iFrame itself.  


The million dollar question is: how do you prevent such double tracking of visitors?


One idea we had was to implement the instructions in the following article: Cross Domain tracking through iFrame, but we are unsure whether this will help or how we can implement this with Google Tag Manager.


Any help would be greatly appreciated!



1 Expert replyverified_user

Re: Tracking users through iFrame elements

Top Contributor
# 2
Top Contributor
Hi Yaakov,

similar to the guide you can use postMessage method with GTM as well or simply decorate the iframe src in order to pass cookie info from one domain to another. You can use this guide in order to push a postMessage GTM based solution:

Hope it helps.

Kind regards,
Web analyst @