Home > Technical & Creative Skills > Tracking Campaigns

Passing UTM Tagging to shopping cart system in GA (3)


09-07-2014 03:58 PM #1 house_l (Member)
Passing UTM Tagging to shopping cart system in GA

Hi Guys,

I have a set up like this:

Landing page built with wordpress, its got buy buttons that has an absolute URL to the shopping cart cms(magento)

I am using google analytics to track, the UTM tags, now the problem is all the UTM tags are replaced with a blank referral tags when visitor clicks on the buy button that goes to the checkout page in another cms.

Both of these are on the same server with the same domain, but the lander (wordpress) is installed on a subdirectory (domain.com/lp)

Is there a PHP script that I can put on the lander that will pass the original UTM from traffic source unto the absolute url linked in the buy buttons so that I can track conversions correctly ?

Thanks for any help


09-07-2014 05:03 PM #2 theboss (Member)

Can you add javascript to the pages for the shopping cart?

Maybe:

1) set a referer cookie on the LP that gets the utm_source, etc.

2) trap outbound links with jQuery and append GA stuff to URL

I have used that method in the past.


09-07-2014 11:58 PM #3 zeno (Administrator)

Well, you could just use simple PHP to append the UTM parameters to the buy button, though I would have thought that GA cookies people and you don't need this??

You could use what theboss mentioned, though I'm a JS noob so can't provide an example.

For PHP you could just append the entire URL query string to the buy button link, e.g.

<a href="buybuttonlink.html?<?php echo $_SERVER['QUERY_STRING']; ?>" target="_top" />


I have a tutorial on passing query strings in JS, perhaps you can use something similar to append them if you can't use PHP - http://stmforum.com/forum/showthread...s-querystrings!

Javascript appears to have an inbuilt getURLparam function, I think.


Home > Technical & Creative Skills > Tracking Campaigns