AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

Ads
4.8K members online now
4.8K members online now
Learn about the Google Ad Grants advertising program for nonprofits
Guide Me
star_border
Reply

Cross Domain Tracking - unique page visited

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

I would like to track a link from one domain, santabarbaratriathlon.com to a specific page on another domain. Is this considered Cross Domain Tracking? Can you look at the crazy code I developed that is now on the destination domain page I would like to be tracked and reported on santabarbaratriathlon.com's analytics page .By the way where do I find these results in analytics? And do I even need the pixel tracker if all I want to show is that a user clicked a button on one domain and that they landed on the destination specific page? Also I wanted to show that it came from a campaign but I cant figure out what to replace ('direct') with or what that means?

 

I have implemented this on the destination domain specific form landing page:

 

<script>
var match=false;
var page = window.location.toString();
page = page.toLowerCase();


if (page.indexOf("receipt.aspx") > -1)
{
match = true;
}

if (match==true)
{
var img1 = new Image();
img1.src='http://img.santabarbaratriathlon.com/form-completed.gif?dl=http%3A%2F%2Fiamathlete.com%2Fcart%2FRece...
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*newDate();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-5791741-23', 'santabarbaratriathlon.com', 'SBTriTracker', {transport: 'beacon'});
ga('send', {'hitType': 'pageview','location': 'http://www.iamathlete.com','page': '/cart/Receipt.aspx','campaignName': '(direct)','referralPath'});

}

match = false;

if (page.indexOf("eventreg_selecttype.aspx") > -1)
{
match = true;
}

if (match==true)
{
var img2 = new Image();
img2.src='http://img.santabarbaratriathlon.com/form.gif?dl=http%3A%2F%2Fiamathlete.com%2Fcart%2FReceipt.aspx&d...
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*newDate();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-5791741-23', 'santabarbaratriathlon.com', 'SBTriTracker', {transport: 'beacon'});
ga('send', {'hitType': 'pageview','location': 'http://www.iamathlete.com','page': '/events/EventReg/EventReg_SelectType.aspx','campaignName': '(direct)','referralPath'});
}
</script>

 

Do I have to place something on the initial domain page? A cross domain tracking code of some sort? Thank you for your help I have worked/donated hours for this client and am having no luck getting this to work. I think it is because the code I wrote is crap and then I do not have any cross link script on the starting domain, santabarbaratriathlon.com. I am doing this as a favor and for free so the 30 hours I spent already has killed me but I want to learn how to do this..Thank you - Greg

Re: Cross Domain Tracking - unique page visited

Visitor ✭ ✭ ✭
# 2
Visitor ✭ ✭ ✭
I also realize the referralPath needs to be removed or corrected and that I have two script errors so this should be:

&lt;script&gt;
var match=false;
var page = window.location.toString();
page = page.toLowerCase();


if (page.indexOf("receipt.aspx") > -1)
{
match = true;
}

if (match==true)
{
var img1 = new Image();
img1.src='http://img.santabarbaratriathlon.com/form-completed.gif?dl=http%3A%2F%2Fiamathlete.com%2Fcart%2FRece...
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*newDate();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-5791741-23', 'santabarbaratriathlon.com', 'SBTriTracker', {transport: 'beacon'});
ga('send', {'hitType': 'pageview','location': 'http://www.iamathlete.com','page': '/cart/Receipt.aspx','campaignName': '(direct)'});
}

match = false;

if (page.indexOf("eventreg_selecttype.aspx") > -1)
{
match = true;
}

if (match==true)
{
var img2 = new Image();
img2.src='http://img.santabarbaratriathlon.com/form.gif?dl=http%3A%2F%2Fiamathlete.com%2Fcart%2FReceipt.aspx&d...
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*newDate();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-5791741-23', 'santabarbaratriathlon.com', 'SBTriTracker', {transport: 'beacon'});
ga('send', {'hitType': 'pageview','location': 'http://www.iamathlete.com','page': '/events/EventReg/EventReg_SelectType.aspx','campaignName': '(direct)'});
}