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?