简体   繁体   中英

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!

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.

在此输入图像描述

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM