Mobile app version of vmapp.org
Login or Join
Turnbaugh106

: Using Google Analytics to track my content in iframe on third-party sites? I have built a small visualisation and I want to allow third-party users to embed it within an iframe on their pages.

@Turnbaugh106

Posted in: #Analytics #Embed #GoogleAnalytics #Iframe

I have built a small visualisation and I want to allow third-party users to embed it within an iframe on their pages.

When they do this, I would like to use Analytics to track (i) how many people have seen the visualisation and (ii) the URLs on which it has been embedded.

The HTML and JS of my visualisation are both on the same domain, but obviously my domain is different from the domains on which it has been embedded.

I have read Google's documentation on iframes but it isn't helping me a great deal!

Two questions:


Can I just use the basic Analytics setup in the normal way in my HTML, or are there any issues I need to be aware of?
How do I pass in the parent URL as a custom dimension? Presumably I can't just get the URL of the parent page, for security reasons, so I'm wondering if I need to do something like this?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Turnbaugh106

1 Comments

Sorted by latest first Latest Oldest Best

 

@BetL925

Be sure to use a custom tracker object for your Google Analytics script. The reason behind this is if a site is running Google Analytics, then their script calls might end up being recorded in your account as well!

So you cannot use the default GA script, but would rather use this Google Developer documentation on Creating Trackers.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme