Page 1 of 1

Creating affiliate cookie outside opencart

Posted: Tue Mar 13, 2012 12:45 am
by Xellz
Is there a relative simple solution for adding code to page not related to opencart? Why i want this, my opencart store is located in /shop and i would like to add ability to accept tracking code to home page.

Re: Creating affiliate cookie outside opencart

Posted: Tue Mar 13, 2012 5:47 am
by ocmta
Add ?tracking=<code> (or &tracking=<code> if the URL already contains ? ) to the page's URL, and the page itself should contain following PHP code:

Code: Select all

if (isset($_REQUEST['tracking']) && !isset($_COOKIE['tracking'])) setcookie('tracking', $_REQUEST['tracking'], time() + 3600 * 24 * 1000, '/');

Re: Creating affiliate cookie outside opencart

Posted: Wed Mar 14, 2012 3:01 am
by Xellz
ocmta wrote:Add ?tracking=<code> (or &tracking=<code> if the URL already contains ? ) to the page's URL, and the page itself should contain following PHP code:

Code: Select all

if (isset($_REQUEST['tracking']) && !isset($_COOKIE['tracking'])) setcookie('tracking', $_REQUEST['tracking'], time() + 3600 * 24 * 1000, '/');
Thanks a lot, really simple and works properly!

Re: Creating affiliate cookie outside opencart

Posted: Thu Apr 12, 2012 7:39 pm
by skimottaret
Xellz, we have the same desire to add tracking cookies to our home page and i would like to implement the solution on our home page as well. I looked at the source for your homepage and dont see the code as described, is this still working for you?

www.insideoutskiing.com home page

http://www.insideoutskiing.com/sales/in ... ommon/home opencart shop

Re: Creating affiliate cookie outside opencart

Posted: Thu Apr 12, 2012 7:54 pm
by ocmta
It's php, you can't see it in the page source.

Re: Creating affiliate cookie outside opencart

Posted: Thu Apr 12, 2012 7:58 pm
by skimottaret
thank you ocmta i am a non programmer so perhaps this solution is beyond my capability

Re: Creating affiliate cookie outside opencart

Posted: Tue May 01, 2012 8:43 am
by alexismertens
Hello,

It seems that this solution works only when the root domain name is the same as the domain name of the root of the domain of the opencart installation.

How to do this if it is another domain ? What to change in the script to create the cookie for the right domain ?

thank you

Re: Creating affiliate cookie outside opencart

Posted: Wed Sep 19, 2012 4:11 pm
by skimottaret