Page 1 of 1

Affiliate tracking priority

Posted: Thu Oct 18, 2012 5:17 pm
by lpccoder
After read about Affiliate Program on Opencart I can tell this:
Comission are only based on a cookie tracking value.
For example, let suposse there are two affiliates Affiliate1 and Affiliate2 that have tracking1 and tracking2 codes.
If Affiliate1 send a customer to our Opencart the tracking1 code is set in a tracking cookie for 1000 days.
If some days (less than 1000) after Affiliate2 send the same customer to our Opencart using the tracking2 code, the tracking1 code is not removed. I mean that if the customer makes a purchase the comission goes to Affiliate1.
In this 1000 days any purchase made from this customer generates a comission to Affiliate1 unless customer deletes his cookies.
Is a "Who beats the first beats the best" situation that is not common in Affiliate Programs. In my opinion this should be changed.

Re: Affiliate tracking priority

Posted: Tue Oct 23, 2012 4:36 pm
by lpccoder
I changed the index.php file to achieve this

Code: Select all

// LPCCODER Mod - Change days to 360 and last affiliate get the comision
/*
if (isset($request->get['tracking']) && !isset($request->cookie['tracking'])) {
	setcookie('tracking', $request->get['tracking'], time() + 3600 * 24 * 1000, '/');
}
*/
if (isset($request->get['tracking'])) {
	setcookie('tracking', '', 1); // Deletes the cookie
	setcookie('tracking', $request->get['tracking'], time() + 3600 * 24 * 360, '/');
}
// END LPCCODER Mod
I'm not an OpenCart expert but I think this should work as expected, I mean, that the last affiliate link get the comission over a year.

Re: Affiliate tracking priority

Posted: Tue Jan 01, 2013 8:22 pm
by beavo
Has anybody tried this change? Did it work as expected?

Re: Affiliate tracking priority

Posted: Wed Jan 02, 2013 5:01 am
by ocmta
It will work exactly as described.

Re: Affiliate tracking priority

Posted: Wed Jun 12, 2013 7:35 pm
by al3xandr1a
Will this work with version 1.5.4.1?

Re: Affiliate tracking priority

Posted: Wed Jun 12, 2013 9:14 pm
by ocmta
Yes, it will.

Re: Affiliate tracking priority

Posted: Mon Jun 17, 2013 12:26 am
by al3xandr1a
With the recommended code change above, what happens if the customer visited the site the next day without using the affiliate link given to him by the affiliate? Say, the customer goes direct to page using the naked URL, will the new code delete his cookie yesterday? ---which would mean the affiliate wont get commission.

Please let me know your thoughts on this... Thank you.

Re: Affiliate tracking priority

Posted: Mon Jun 17, 2013 1:08 am
by ocmta
al3xandr1a wrote:Say, the customer goes direct to page using the naked URL, will the new code delete his cookie yesterday?
No, it won't delete the cookie, affiliate will still get the commission.

Re: Affiliate tracking priority

Posted: Mon Aug 05, 2013 9:44 pm
by myshadowself
Oh - this code example implements the Affiliate Industry standard of "Last Click" AKA "First past the post" attribution that every affiliate network worldwide used until recently when "Multi Affiliate Attribution" was standardised (still only a small percentage use that) .

I'm sure Daniel states that this is wrong here: http://code.google.com/p/opencart/issues/detail?id=414

And it must be wrong, because Daniel says it is wrong and everyone else does it the way Daniel says is wrong, so it must be wrong because it is not Daniel's way.

So it goes against all the "Open" in "OpenCart" to use the above code, as it is clearly wrong and you are wrong and so are you. Don't you dare use that wrong code.

Re: Affiliate tracking priority

Posted: Mon Aug 05, 2013 10:00 pm
by ocmta
Since 1.5.5 openCart does it this way, no modification required

Re: Affiliate tracking priority

Posted: Sat Dec 12, 2015 12:28 am
by Tee15
Hello,

I have a question as I'm working on the same situation. I searched thru my code and found this in my template version:

// Affiliate
$registry->set('affiliate', new Affiliate($registry));

if (isset($request->get['tracking'])) {
setcookie('tracking', $request->get['tracking'], time() + 3600 * 24 * 1000, '/');


Since that was already in there i just changed the 1000 to 60 for sixty days like this

// Affiliate
$registry->set('affiliate', new Affiliate($registry));

if (isset($request->get['tracking'])) {
setcookie('tracking', $request->get['tracking'], time() + 3600 * 24 * 60, '/');


I'm just wondering, to achieve only a 60 day cookie, would that be all I need to do since my version already had the initial coding? Or would I still need to add all of the code previously mentioned in this thread above?

Thankful for any advice.

Re: Affiliate tracking priority

Posted: Wed Dec 23, 2015 9:41 pm
by gogoweb
I think this should be enough.