pipwerks / PDFObject

A lightweight JavaScript utility for dynamically embedding PDFs in HTML documents.
http://pdfobject.com/
Other
2.39k stars 986 forks source link

Is there a way to track button clicks? #289

Closed andrisole92 closed 1 year ago

andrisole92 commented 1 year ago

E.g. I want to know when and how people click download button or any other buttons?

pipwerks commented 1 year ago

No, PDFObject simply embeds the file into the HTML page. PDF rendering engines don't provide an API for tasks like click tracking. You'd have to build your own by modding PDF.js or similar.

knubew commented 1 year ago

Basically, you could use the click event for the button that calls up the PDF. Then you can at least track who called up the PDF for display. At least that's how I do it in my project.

If you use jQuery in your project, have a look here: http://api.jquery.com/click/

For pure vanilla script look here for example: https://wiki.selfhtml.org/wiki/JavaScript/DOM/Event/click