Copy link to clipboard
Copied
Hi,
I'm using an external analytics API on my site. For it to be able to track activity in iframes, they say I need to include the tracking code into said iframes as well. In other cases, even for iframes from other domains, this simple thing worked:
<iframe src="...">
<script>
//tracking code
</script>
</iframe>
But with the PDF Embed API I'm starting with a div, in which the iframe is created dynamically. Is there any way I can get my tracking code there?
I tried adding the tracking code into the iframe.innerHTML after it's created but that doesn't seem to work for the tracking...
Thanks in advance!
Copy link to clipboard
Copied
You don't need to add the tracking code to the embedded iframe. Instead, hook into the viewer event callbacks to trigger the analytics.
Copy link to clipboard
Copied
Thank you for the quick reply!
I think I have to (or I don't understand exactly what you mean). To be more specific, I'm using mouseflow.com, and according to this: https://help.mouseflow.com/en/articles/4282949-can-i-record-iframes-and-pop-up-windows the tracking code has to be there. In any case where I use iframes, unless I insert tracking code into the iframe, the iframe doesn't show in the mouseflow recording at all, there's just blank space.
Copy link to clipboard
Copied
Ok. Mouseflow is a bit different from typical analytics. It's a heatmap. We don't have hooks for that. You won't be able to use it with Embed API.