简体   繁体   中英

Google Analytics in Wordpress - Cross-Domain Tracking

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!

Try stacking them in the onclick event like this:

    <a href="javascript:void(0);" onclick="loadevent('http://www.EXAMPLESITE.com/course/4105/register.asp');pageTracker._link('http://www.EXAMPLESITE.com/course/4105/register.asp'); return false;">Register</a>

It should run all of the commands as long as they're separated by semi-colons.

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