Mautic Community Forums

Tracking clicks in a PDF

Hey all,



I’m new to using Mautic and was wondering if anyone knows of a way to insert the Mautic JS tracking code into a PDF file. Or, if anyone knows of a software out there that can convert a PDF document into something else which you could then insert the tracking code into. Tried searching on the internet for hours on end but couldn’t come up with anything.



As an aside, I believe Google Analytics can track certain PDFs that have a field for you to enter the Google Analytics tracking ID, but none of these allow you to enter actual Javascript. Is there a way to get the Google Analytics data to automatically show up in the Mautic portal under a contact’s history?



Any help or advice would be much appreciated! Thanks a lot!

Hey all,

I’m new to using Mautic and was wondering if anyone knows of a way to insert the Mautic JS tracking code into a PDF file. Or, if anyone knows of a software out there that can convert a PDF document into something else which you could then insert the tracking code into. Tried searching on the internet for hours on end but couldn’t come up with anything.

As an aside, I believe Google Analytics can track certain PDFs that have a field for you to enter the Google Analytics tracking ID, but none of these allow you to enter actual Javascript. Is there a way to get the Google Analytics data to automatically show up in the Mautic portal under a contact’s history?

Any help or advice would be much appreciated! Thanks a lot!

I’ve never heard about an PDF viewer executing a javascript code or making a HTTP request when the file is opened. All I can advice is to upload the PDF file as the Mautic Asset, put the generated download link to some public web page and Mautic will track the downloads of the file.

Hey, thanks a lot for the response @escopecz - I really appreciate it!

I found a PDF viewer online called pdf.js : https://mozilla.github.io/pdf.js/. Would it be possible to insert the Javascript tracking code somewhere into this PDF viewer’s code and track user interaction inside the PDF (i.e. time spent on a certain page)? And if so, where would you suggest it be inserted? Thanks!

They describe it as:

I don’t see anything about a tracking.