1.9K members online now
Learn how to set up goals and Ecommerce tracking, verify accuracy of attribution traffic sources, and discuss funnel visualization, Multi-Channel Funnels, the Goal Flow Report, and Enhanced Ecommerce
Guide Me

iframe tracking

Follower ✭ ✭ ☆
# 1
Follower ✭ ✭ ☆


im stuck, i hope that someone can help me.


In order to track clicks in an iframe, i did something unusual: i inserted an analytics script inside the head of the iframed page. then i used analytics events in order to track clicks on that iframe. 


you can see an example here: https://www.digital4.biz/retail/ecommerce-oltre-11-milioni-di-clienti-abituali-l-analisi-del-politec...


the event triggered after click is onclick="ga('send','event','Lead','click_txt','CRM_266_2')"


the iframe src (https://filedig.ctmobi.it/redazioni/crm.html)


do you think this can be done? or can it cause some conflicts? 


i have uncoungruent data: the number of clicks (events) tracked for the first GA property (the iframe), are not corresponding to the number of sessions that i get after the link with utm parameters has been viewed after the click. 

Do you have any idea on why this could happen? 

Hope I was clear enough, else, I can give you more information!


Hope someone could help as im stuck here and seem to find no easy way out!

Thanks a lot for help on this. 




1 Expert replyverified_user

Re: iframe tracking

Community Manager
# 2
Community Manager
Hi Eugenio T,

Thanks for posting to the community. I will look into this for you and update this thread or reach out to you directly via email for more information.



Re: iframe tracking

Follower ✭ ✭ ☆
# 3
Follower ✭ ✭ ☆
Hello Krisha
Thanks a lot for your reply!
Hope you can help fixing this issue.
Looking forward to your reply.
Marked as Best Answer.
Accepted by topic author Eugenio T
May 2016

Re: iframe tracking

Community Manager
# 4
Community Manager

Hi Eugenio,


I checked with our tech team and we were unable to locate any iFrame set to the src '(https://filedig.ctmobi.it/redazioni/crm.html)' on your website. Is this iframe still active?


What you're doing should work. However, the clicks on an element may not match the pageviews to the link being clicked on -- you can expect a certain level of discrepancy, and, depending on the implementation, the discrepancy could go either way (more clicks than sessions, or more sessions than clicks). Here are some of the reasons:


  1. The entire iFrame isn't linked to a page, only a part of it is. However, clicks on any part of the iframe will be tracked using the lead event.
  2. Users who prevent the page from loading (stop or back button) after clicking the link
  3. Race Condition: The page loads prior to GA tracking the click
Points 1 and 2 could explain why you may see more clicks, and point 3 might explain why you may see more sessions.
Hope this helps.

Re: iframe tracking

Follower ✭ ✭ ☆
# 5
Follower ✭ ✭ ☆
Thanks a lot Krisha!
It explains a lot Smiley Happy Great to know we were doing good Smiley Happy
Thanks again!
Have a nice day.