3

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!

Avag Sargsyan
  • 2,437
  • 3
  • 28
  • 41

1 Answers1

2

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.

ron4ex
  • 1,073
  • 10
  • 21
  • Unfortunately, I don't see that option on my end. Maybe it has been removed? – Davide Taraborrelli Oct 23 '16 at 19:09
  • The screenshot refers to the very latest version of the Visual Composer. Which version are you using? – ron4ex Oct 23 '16 at 19:15
  • 1
    I'm sorry, you're right. I wasn't on the latest version. Wordpress wasn't prompting for updates, that's why I missed it. For some reason, I had to update the whole theme before being able to update VC. It works perfectly now! Thank you so much for you're answer and solution, I really appreciated the time you dedicated to my issue. Thank you ron4ex! – Davide Taraborrelli Oct 23 '16 at 19:40
  • 1
    You're welcome. Great that it worked. I've updated my answer mentioning the Visual Composer version, so it may help others. – ron4ex Oct 23 '16 at 19:48