Mobile app version of vmapp.org
Login or Join
Angie530

: Is it possible to track URL parameters and then the value of a cookie? I have recently launched a site for a customer which we would like to track initial visits on URLs like below via Google

@Angie530

Posted in: #Cookie #GoogleAnalytics #Tracking #UrlParameters

I have recently launched a site for a customer which we would like to track initial visits on URLs like below via Google Analytics, and then track revisits on their respective referral code:

Users visit:


domain.com/?ref=code1
domain.com/?ref=code2
domain.com/?ref=code3


Once they land, we drop a cookie with the ref code and this determines what they see on revisiting the site. They are locked to this ref code unless they go through another affiliate website and come in on a new referral code.

We would like to know which code they came in on, and then know which code is within the respective cookie? That data can then be drilled down into via filters or separate profiles perhaps?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Angie530

2 Comments

Sorted by latest first Latest Oldest Best

 

@BetL925

I second dm-guy that Google Analytics campaigns is the best way to track this.

If your referral code determines the content of the site, you will still have to cookie it yourself: With Universal analytics the campaign information is stored on Google's servers rather than directly in the cookies, so you can't access it to change the page. You will still need to let Google Analytics know about the parameter in the campaign format that it expects.

You have a couple of options for implementing. The first is change the incoming URLs to include the parameters that Google Analytics expects for tracking campaigns. You can use the Google Analytics URL builder to generate something like this:

domain.com/?ref=code1&utm_source=referringsite&utm_medium=affiliate&utm_content=code1&utm_campaign=affiliate-program-2014


If your single code parameter implies all the information that Google analytics needs, then you could set the parameters dynamically with Javascript based on your referral code. Add this to your Google Universal Analytics snippet before the create line when the ref parameter is present in the URL:

ga('set',{
campaignName:'affiliate-program-2014',
campaignSource:'referringsite',
campaignMedium:'affiliate',
campaignContent:'code1'
});


Documentation:


set method
campaignName field
campaignSource field
campaignMedium field
campaignKeyword field
campaignContent field

10% popularity Vote Up Vote Down


 

@Debbie626

You can use UTM query string parameters and assign each of them to a different campaign, which will mark the affiliate. On GA you will be able to analyze the traffic according to this specific campaign and see how many converted.

For example, you can do:

domain.com/?utm_campaign=affiliate1/2/3&utm_source={affiliate_domain}&utm_medium=affiliate-link&ref=code1/2/3


(1/2/3 - a number for each affiliate)

In the default settings of GA, once a user arrives with a new campaign code, he is from that moment assigned to the new campaign.

You will have to ask your affiliate to add these parameters to the target URL, or to do a URL rewrite.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme