1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

affiliate software creation. how to get vars from advertiser

Discussion in 'PHP' started by master-mind, Nov 29, 2013.

  1. #1
    I am creating a basic and small program in php like cj and linkshare. its not that big and complicated.

    But I need to know about the logic how it actually gets to know if the sale is completed or not on advertiser's website once the affiliate's url is clicked?

    Appreciate the suggestions and advices.

    thanks
    master-mind, Nov 29, 2013 IP
  2. MakZF

    MakZF Active Member

    Messages:
    390
    Likes Received:
    9
    Best Answers:
    1
    Trophy Points:
    70
    #2
    Each lead would need a unique identifier which is then tracked throughout the process, if the sale is made, flag the lead as having generated a sale.
    MakZF, Nov 29, 2013 IP
  3. NetStar

    NetStar Well-Known Member

    Messages:
    1,140
    Likes Received:
    109
    Best Answers:
    19
    Trophy Points:
    115
    #3
    I think if your programming skills were on par to do such a thing the logic should come natural. Utilizing cookies and tracking id's in the query string should of been the first and only thing that popped in to your head. Somehow, I just don't think you will ever finish this project if you have to ask such an elementary question.
    NetStar, Nov 29, 2013 IP
  4. ImgPlanet

    ImgPlanet Greenhorn

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    21
    #4
    in here not anyone explain all code because its not small code its many function involve in this code.
    ImgPlanet, Dec 1, 2013 IP
  5. ImgPlanet

    ImgPlanet Greenhorn

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    21
    #5
    first you create a code of geolocation (this use of database or maxmind)because of geolocation tell you where country ip buy affiliate.
    you create advertiser code . its help you which advertiser buy affiliate .also use with database it get advert id , urlid , click , earn , date
    and use JavaScript or php code like
    siteurl.php?advertid-25&urlid=65
    ImgPlanet, Dec 1, 2013 IP
  6. NetStar

    NetStar Well-Known Member

    Messages:
    1,140
    Likes Received:
    109
    Best Answers:
    19
    Trophy Points:
    115
    #6
    You don't need to use Geolocation for affiliate tracking. That has nothing to do with it.

    - Generate a random id for the affiliate. This is there tracking id. Obviously store this id in your database associated with your affiliate. (For Example: 12345)

    - The tracking id will be in the query string of the URL your affiliate will be using. Let's assign it a variable name of "a" for sake of transparency. (Example URL: blah.etc/product?id=5&a=12345)

    - When a visitor accesses the web site through blah.etc/product?id=5&a=12345 you will have your script either append the tracking id (12345) to each internal link OR you can easily store the id as a cookie.

    - When the visitor makes a purchase fetch the tracking id from the cookie or query string and give credit to the affiliate.


    A GOOD affiliate program WILL store tracking id's in a cookie that expires no less than 14 days. If the visitor lands on the site and doesn't purchase that day your affiliate can still get credit for a purchase made within the allotted time.

    An AWESOME affiliate program WILL save the tracking id fetched from the cookie to a server side database once an account has been created. The affiliate will get credit for the sale at any point since they were the original referral.


    This is actually extremely simple to implement with basic code.
    NetStar, Dec 2, 2013 IP
  7. ImgPlanet

    ImgPlanet Greenhorn

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    21
    #7
    hmmm nice
    ImgPlanet, Dec 2, 2013 IP
  8. DeanIM

    DeanIM Greenhorn

    Messages:
    25
    Likes Received:
    0
    Best Answers:
    2
    Trophy Points:
    21
    #8
    First create a new database table 'tbl_conversions' containing the following columns:
    1. ID (int, unique, auto increment)
    2. Sale (varchar, unique)
    3. Code (varchar, unique)

    On your affiliate script (script that affiliates get that redirects to a product)

    1. Set a cookie 'sale' with a random unique string
    2. Insert row in your tbl_conversions table where 'sale' = $_COOKIE['var']
    3. Redirect to affiliate site with Sale value in a GET var
    What you want to do next is have the merchant site include a javascript that makes a call to your callback script that verifies a successful sale. You can do this by generating a value for 'code' (like 'merchant id + sale id').
    On a successful sale the merchant's code has a javascript that calls yourwebsite.com/sale.php?sale=123&code=10123
    Then on sale.php: If sale & code from your database match with the GET variables from the javascript call, remove the row from database and add it to the successful conversions database!

    This is the basic logic behind having 2 websites talk to each other and verify stuff like conversions.
    DeanIM, Dec 11, 2013 IP