Event tracking

23 August, 2022 07:41:46
adtrak
Topics: 4
Messages: 11
Hi, is there any way we can add event tracking to the PDF button shortcode? We'd like to add something like;

onClick="gtag('event' , 'Click' , { 'event_category' : 'View brochure button', 'event_label' : 'Brochure title' });"

Thanks
23 August, 2022 07:55:03
E2Pdf
Support
Topics: 7
Messages: 3165
Hi,

Unfortunately, the E2Pdf link can't be currently modified with "onclick" event, however, we will review it to add its support.

Meanwhile, If you are using a static URL download name, you can just create your own link as follows:

<a href="[e2pdf-download id='1' output='url' esc_url_raw='true']" onClick="gtag('event' , 'Click' , { 'event_category' : 'View brochure button', 'event_label' : 'Brochure title' });">Download PDF</a>

* Keep attention to quotes

** esc_url_raw='true' in some cases must be removed depending on where the shortcode placed

P.S. If you need the URL to have a dynamic name - let us know please, we will try to speed up by adding "onclick" attribute.

We remain at your service.
We would really appreciate your feedback at WordPress.org!
23 August, 2022 08:16:55
adtrak
Topics: 4
Messages: 11
That looks perfect, thank you!