简体   繁体   English

Onclick事件跟踪Google Analytics Wordpress Visual Composer插件

[英]Onclick Event Tracking Google Analytics Wordpress Visual Composer Plugin

I'd like to add this code for GA event tracking: 我想为GA事件跟踪添加此代码:

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. 但是,我不知道如何在Wordpress中完成它,我的编码知识仅限于从头开始编写一个简单的页面,在这种情况下,我只是在HREF之后添加了一段代码。

Since this page uses Visual Composer I don't know how to add that onclick piece of code to that div. 由于此页面使用Visual Composer,我不知道如何将该onclick代码片段添加到该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. 您希望在Visual Composer中的CTA按钮上添加此跟踪代码。 There is this Advanced on click action option that Visual Composer provides. Visual Composer提供了此单击操作高级选项。 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. 编辑:此解决方案在Visual Composer 4.12版上测试,如果您有旧版本可能无法正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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