Wordpress 中的 Google Analytics - 跨域跟踪
我一直在寻找这个问题的答案,需要专家的帮助。
我正在帮助监督的网站在其主网站的框架中进行了注册。当用户访问该网站时,他们可以选择要参加的课程,然后单击“注册”链接以转到外部托管的表单。
我能够在框架页面上更改 GA 标签,这样步骤就完成了。
但是,我意识到,为了使用 Google Analytics 正确进行跨域跟踪,我还需要向将用户带到这些页面的任何链接添加 onclick 事件,例如下面的示例。
<a href="http://www.mysite.com/page1.html" onClick="pageTracker._link('http://www.mysite.com/page1.html'); return false;"> Link </a>
但是,我正在使用的网站位于 Wordpress 中,当我查看其中的链接时,它看起来像这样:
[iab_event link="http://www.EXAMPLESITE.com/course/4105/register.asp" text="Register"]
当您查看实时网站的页面源时,此链接将翻译为:
<a href="javascript:void(0);" onclick="loadevent('http://www.EXAMPLESITE.com/course/4105/register.asp');">Register</a>
我尝试添加第二个 onclick事件发生在上面的事件中,但这没有用。有没有办法将 onClick="pageTracker._link('http://www.EXAMPLESITE.com/course/4105/register.asp'); return false;" 添加到此链接而不需要打破它?
预先感谢您提供的任何建议!
I've searched high and low for an answer for this problem and need the help of experts.
The website I'm helping to oversee has a registration in a frame on their main website. When a user visits the site, they can choose which course to take and click on a "Register" link to be taken to the externally hosted form.
I was able to get the GA tags changed on the framed pages, so that step is done.
However, I realise that in order to properly cross-domain track with Google Analytics, I need to also add an onclick event to any links that bring users to those pages, such as the example below.
<a href="http://www.mysite.com/page1.html" onClick="pageTracker._link('http://www.mysite.com/page1.html'); return false;"> Link </a>
However, the site I'm working with is in Wordpress, and when I view the link in there it looks like this:
[iab_event link="http://www.EXAMPLESITE.com/course/4105/register.asp" text="Register"]
And when you view the page source of the live site this link is translated to this:
<a href="javascript:void(0);" onclick="loadevent('http://www.EXAMPLESITE.com/course/4105/register.asp');">Register</a>
I tried adding the second onclick event to the one above, but that didn't work. Is there any way to add the onClick="pageTracker._link('http://www.EXAMPLESITE.com/course/4105/register.asp'); return false;" to this link without breaking it?
Thank you in advance for any advice given!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试将它们堆叠在
onclick
事件中,如下所示:它应该运行所有以分号分隔的命令。
Try stacking them in the
onclick
event like this:It should run all of the commands as long as they're separated by semi-colons.