How to track product sales per affiliate id using Google Analytics or Piwik

2.8k views Asked by At

Here is the seemingly standard scenario for an e-commerce site.

  1. There are two products p1 and p2, and two affiliates a1 and a2.
  2. A user visits the product pages via different affiliates: e.g. /p1/affid=a1, /p2/affid=a2
  3. He later return to these pages without the affiliate id and completes the transaction: e.g. /p1, /p2

I need to track each transaction with the affiliate id.


Possible solution: I can set a cookie for (product_id => affiliate_id) when the user visits the page. When user visits the page next time, during transaction I look for a cookie for that product. If I find an affiliate_id, I pass it in GA e-commerce tracking variable.

Is there any better way of doing this? Can this be done entirely using GA without any custom code? Will GA tell me number of visits to the product page before the user makes the transaction?

1

There are 1 answers

0
Nikolay On

Use campaign tracking, e.g. /p1?utm_campaign=affiliate&utm_source=affid1&utm_medium=whatever, thus you'll be able to track e-commerce transactions associated to your affiliates by adding a campaign or source dimension to the report. This tutorial may be helpful(from p. 18 - tracking online marketing): http://services.google.com/analytics/breeze/en/v5/campaigntracking_adwordsintegration-v23_ia5/

If you already have an affiliate management system with custom ids, consider using 301 redirects from /p1/affid=a1 to /p1?utm_campaign=affiliate&utm_source=affid1&utm_medium=whatever

And you'll be able to track 'visits before transaction' metrics in the corresponding report in E-commerce section with a custom segment.