Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Onclick Event Tracking Google Analytics Wordpress Visual Composer Plugin

I'd like to add this code for GA event tracking:

onclick="ga('send', 'event', { eventCategory: 'Contact', eventAction: 'ContactRequest'});"

on this Call To Action

<div class="vc_btn3-container vc_btn3-center vc_custom_1477135392137"><a class="vc_general vc_btn3 vc_btn3-size-md vc_btn3-shape-rounded vc_btn3-style-modern vc_btn3-block vc_btn3-color-grey" href="http://davidetaraborrelli.it/contatti/" title="" target="_blank">CONTATTAMI</a></div>

However, I don't know how to do it in Wordpress, my knowledge of coding are limited to coding a simple page from scratch, in that case I would simply have added the piece of code after HREF.

Since this page uses Visual Composer I don't know how to add that onclick piece of code to that div.

Any help is really appreciated, I hope it makes sense.

Thank you!

like image 805
Davide Taraborrelli Avatar asked Nov 20 '25 08:11

Davide Taraborrelli


1 Answers

Looks like you want to add this tracking code on a CTA button in Visual Composer. There is this Advanced on click action option that Visual Composer provides. You can use that. It is fairly straight forward. Check out the following screenshot.

enter image description here

EDIT: This solution is tested on Visual Composer version 4.12, may not work if you have an older version.

like image 193
ron4ex Avatar answered Nov 21 '25 21:11

ron4ex



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!