How to track cloaked affiliate links in goals?

Hi,

I have search high and low in the forums and in google but I still can’t find an answer to what I’m looking for.

I have a review site (eg. myreview.com), and use a plugin to cloak my affiliate links going to merchant sites like http://www.amazon.com/Casio-GW9200-1-G-Shock-Riseman-Alti-Therm/dp/B001A62M04/ref=amb_link_19995401_11?pf_rd_m=ATVPDKIKX0DER&pf_rd_s=center-3&pf_rd_r=1W1Z91MJ3EMA78GKZ6N5&pf_rd_t=101&pf_rd_p=488790311&pf_rd_i=507846 to a “pretty link” like http://myreview.com/visit/amazon

I want to be able to track the cloaked affiliate link --> http://myreview.com/visit/amazon in goals so I can see how many times my affiliate links gets clicked on.

In creating a goal, when goal is triggered when visitors --> do I choose:
Option 1 --> Visit a given URL (page or group of pages)
where the URL (it says Page Title by the way which I think is wrong) contains “http://myreview.com/visit/” or just “visit/” is enough?
or
Option 4 --> Click on a Link to an external website
where the external website URL contains amazon.com?

I am confused as to which above mentioned option is the correct one to use. The cloaked link is obviously for an external website, but the cloaking plugin uses my site’s URL to mask the affiliate link.

Any help with this would be greatly appreciated.

In this case, it’s a bit different, because the link is neither external (option 4 will not work), and it is not a “Page view” as such, because the JS tracker is not executed in your cloacked page (option 1 will not work).

2 options:

  1. In your cloaking page, instead of redirecting directly to the URL, have a HTML page load, with the Piwik JS code in it, and redirect the visitor after 1 second to your affiliate URL

  2. In your cloacking page (for example doing the redirect in PHP), you can use the tracking API and trigger the goal manually: Tracking API - Analytics Platform - Matomo

Hi Matt,

Thanks for your response, but I am having difficulty understanding the jargon…
What do you mean by “cloaking page”?
How do you do a HTML page load with the Piwik JS code in it?

Do both the solutions you provided above stop me from using the plugin on my wordpress site?

I just tried to read the Piwik Tracking API page you directed me to, and it is way over my head to understand…

Do you know of any other analytics solutions that can track cloaked affiliate links?
Will this feature be added into piwik in the future?

Currently, what is the code source of your page that redirects to amazon?

you could write something like


<html>
<head>
<meta http-equiv="refresh" content="1;url=http://amazon.com/xyz/"> 
</head>
<body>

PIWIK JS CODE HERE

</body></html>

Hello, great post thank you for the input.

My question, is there a way to avoid the 1 sec delay? Maybe insert client side redirect using javascript ? WHat if 1 sec is too long or not enough to track what piwik needs?

(location.href = ? Maybe )

Does option 1 (Visit a given URL) have to be an Internal website where Piwik has stats pages on it?

Also, anyway to hijack the stats from Google Adwords Javascript or other 3rd party banner servers? They decide on the image and the URL, so don’t think you can track this? Maybe track external clicks going to doubleclick.net who they farm it out too. ( I think won’t work because its a javascript induced link as below

And option 4 (external website) will not work unless its a normal hyperlink part of the DOM , and not part of any javascript induced URL click?

You can also use the tracking api to avoid using javascript and therefore the delay: Tracking API - Analytics Platform - Matomo