• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers

Custom tracking on embedded PDF

New Here ,
Nov 03, 2020 Nov 03, 2020

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!

TOPICS
How to , PDF Embed API

Views

314

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 03, 2020 Nov 03, 2020

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. 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 03, 2020 Nov 03, 2020

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.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 03, 2020 Nov 03, 2020

Copy link to clipboard

Copied

LATEST

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.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources