Search code examples
opencartaffiliate

opencart affiliate tracking not working


I want to track visitors coming from affiliate websites to my shopping cart. I see they have affiliate tracking, but I cant seem to find documentation. i tried adding ?tracking=idhere to URLs but its not working. I have added an affiliate and set the commission rate but still nothing.

Update: Using Version 1.5.2.1. I basically need a howto on affiliate tracking. I've never used it or opencart for very long. I can see any decent documentation. Is affiliate tracking built in or do I need a 3rd party extension for what I want.

Update 2: I dumped the $_SESSION variable on the cart page, and the tracking code isn't there.

Array
(
    [language] => en
    [currency] => USD
    [cart] => Array
        (
            [51] => 1
        )

    [captcha] => 93e639
    [vouchers] => Array
        (
        )

)

Solution

  • Tracking isn't done through sessions, it's done through a cookie. You can see the cookie code in the index.php file

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

    This is then captured during the checkout process, which you can see in

    /catalog/controller/checkout/confirm.php

    If this isn't working, then you are either not putting the correct id for an affiliate, or cookies aren't being saved/read correctly for some reason