Results 1 to 2 of 2
  1. #1

    Unhappy PHP Cookie for Affiliate Tracking


    i have a problem with setting and reading cookie for tracking affiliate program.

    here is the situation i currently have:

    on affiliate website (

    a href=

    when users click on this
    user is redirected to merchant bbb's website and a cookie with an affiliate id aaa is created on users machine named AID, for example.

    this is the simple code to write cookie
    PHP Code:
    on merchant's website (
    an image tag
    img src= width=1 height=1

    is placed after an action is taken (signs up to mailing list or whatnot)

    this tracker.php is to read $_COOKIE['AID'] and stores it to my DB.
    to read cookie
    PHP Code:
    here is the problem i am experiencing.

    when i test the entire process (from 1 to 2) on it works perfectly but when i test using different domain name such as above (
    and run it, the cookie is not read. the tracker.php is indeed called as the activity log shows and also i have tested using iframe window to see if it is actually called.

    on the other hand, when i plance the [] alone in the browsers address bar, it works fine.

    i am having headache with this problem, someone please help me out with this!

    best regards,

  2. #2
    It is not reading it under a different domain because you have set the cookie and told it to only read from "".

    Try using this piece:
    PHP Code:

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts