Results 1 to 11 of 11
  1. #1
    ABW Ambassador
    Join Date
    June 30th, 2007
    Location
    Syracuse, NY
    Posts
    677
    Script (PHP?) to track IP and not show same content to same IP twice.
    If the title didn't make any sense, here is what I'm wondering / hoping could be done.

    Have a script that shows different affiliate offers. For example, CPA submits. Instead of having the same person see the same ones and possibly double submitting, is there a way to set up a data base and php script to show each offer once per IP? (or even more advanced, only stop showing it if they submitted?)

    I know how to do random generation from a PHP script. This would be taking it to a new level.

    Doesn't need to be PHP either, I just have a kinda basic knowledge of it lol.

    So is it possible? And hopefully any sites out there explaining how to? Or bit beyond the do it yourself and got to hire someone?

    Thanks!

  2. #2
    Full Member
    Join Date
    November 21st, 2010
    Posts
    230
    I don't do CPA so I don't know that much about the mechanics, but I'm assuming that unless the CPA offers some sort of callback functionality upon completion, there will be no scientific way of knowing if and how the action was completed since it's presumably occurring on someone else's server.

    As to simply showing different ads each time, it is quite possible, though I'm not sure how practical. If I were to do it, however, I would set up a MySQL database table to key on the client IP (which PHP provides quite easily via the $_SERVER['REMOTE_ADDR'] variable) and then track which CPAs are served. On the most fundamental level, you could have just a separate record for each CPA ad/IP address combo. You could then randomly select your CPA, do a query to see if that combination exists in the table and if not, show it and add it to the table; otherwise randomly choose another and repeat the process until you find one that doesn't match. Of course you may end up at a point where the visitor has seen all your ads, so you'll want to account for that and not get caught up in an infinite loop.

    Alternatively, you could do it sequentially. Have an array (either via script, text file or separate database table) of each of your offers, each with a unique ID in the form of a counter, and then just keep track of the corresponding # last served to that particular IP. One simple query tells you if a CPA has been served to that IP and, if so, which one, then just show the first/next one in the list and update the counter. It's also easier to tell when a visiting IP has seen all the available CPAs altogether.

    The sequential method is what I'd be inclined to use. Two tables. One with the offers, the others with visitor history

  3. #3
    ABW Ambassador
    Join Date
    June 30th, 2007
    Location
    Syracuse, NY
    Posts
    677
    I just used CPA as an example, because those are most likely the ones that could get double or more submits for the merchant. Leads too I figure could.

    I realized, IP may not work if a user sees the ad, but doesn't click, then it would be blocked from him or her.

    The array idea does sound better. Perhaps it could just go in order, once it reaches the end, start over. Then new deals could be swapped in or more added to the array.

    Actually, just an array that goes in order and starts over, wouldn't even need to bother with IP, I believe? And just hope the person ignores offers they already took. Might be simplest method.

    I always like looking for the hardest, lol.

  4. #4
    Full Member
    Join Date
    November 21st, 2010
    Posts
    230
    not tracking IP wouldn't be the best approach to ensure that the same person wouldn't keep seeing the same ad. for example if you have 2 ads and 2 visitors, #1 sees ad 1, then #2 sees ad 2, then #1 sees ad 1 again. The more ads you have, the less likely, but if you really want to limit it, it's not the best approach. but I don't think that's your primary concern.

    if it is, there are ways to track if something is actually clicked. You can either use a redirect script as an intermediate which can log the click, or do something with javascript for a more transparent action.

    but i think we're both in agreement that this seems to be a far more complicated solution than necessary.

    in this case, randomness is probably your best bet. With sequential, you'll need to record/read where you left off, but random doesn't require that effort as you just decide which to show on the fly.

  5. Thanks From:

  6. #5
    ABW Ambassador
    Join Date
    June 30th, 2007
    Location
    Syracuse, NY
    Posts
    677
    I have set up a random PHP script / file before too.

    Ah, I see your point there. An array would be counting everyone together. Not individually. Suppose a cookie or something could be left in the browser that does the counting so it can be specific for individual people and go up? Then when session end, cookie gone.

    Is something to make the array individual possible? Cookie, IP, etc. I imagine it is, but very basic php skill lol.

    Think I'll forget about the click tracking. And thanks for the input!

  7. #6
    Full Member
    Join Date
    November 21st, 2010
    Posts
    230
    You could relatively easily use cookies to keep track of the sequence #. I still think a combination of array and randomness would be the best implementation for you. PHP even has a function to pull a random element out of an array, array_rand(). SQL has a random query too but it's reportedly very slow and awkward to use.

  8. #7
    ABW Ambassador
    Join Date
    June 30th, 2007
    Location
    Syracuse, NY
    Posts
    677
    Thanks. I think I would like to have it so each individual viewer got to see the ads cycle through in order. Hmm.. maybe that's a better way of describing it?

    Would you know how that's done by cookies or a site that could explain it? And I imagine that shouldn't slow down load times, right?

    I think the random element array, would be the backup plan. I'd just like each ad to get equal exposure.

  9. #8
    Full Member
    Join Date
    November 21st, 2010
    Posts
    230
    Won't really affect speed/performance, but you're entering into privacy areas with cookies. I'd just google it.

  10. #9
    ABW Ambassador
    Join Date
    June 30th, 2007
    Location
    Syracuse, NY
    Posts
    677
    Hahaha.. I google it and this thread came up first.

    Thanks, I'll do some searching. Hopefully find an answer.

  11. #10
    Newbie
    Join Date
    March 13th, 2010
    Posts
    20
    A Mysql query for every visitor just to check the IP means a busy mysql. I use Semaphores across my network of sites... local file access is faster and doesn't require Mysql.

    Semaphores are good for IP lookups, and a cronjob can cleanup later. Semaphore is just a technical name for creating a file (blank or otherwise) for each process, in this case a new visitor.

    You could put even put in the AD id's in the files, so that you can track which Ads that particular IP has seen.

  12. #11
    Member soda's Avatar
    Join Date
    March 26th, 2010
    Location
    Irvine, CA
    Posts
    36
    Quote Originally Posted by Hardaka View Post
    I know how to do random generation from a PHP script. This would be taking it to a new level.
    Hardaka, IMO you're better off doing it on the client side with Javascript. First of all, targeting by IP is wrong in the first place because IP's are typically shared and many clients may have same IP. So targeting by session is much more precise.

    But main concerns in doing anything like this server side are these:
    1. You can't cache pages. You have to re-generate content for each pageview. Not good for your site performance.
    2. What are you going to show to search engines? Also random products?


    You're better off loading ALL items onto the page but then displaying only a random selection via Javascript. Way faster for the user AND search engine friendly.
    [URL="http://www.itemscope.com/"]Itemscope[/URL]

  13. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. Getting video content to show
    By bluedogs in forum Introduce Yourself
    Replies: 0
    Last Post: February 26th, 2009, 01:06 AM
  2. Keeping track of IF in PHP
    By Doug247 in forum Programming / Datafeeds / Tools
    Replies: 16
    Last Post: April 21st, 2008, 04:29 PM
  3. Show Text One Time via PHP
    By AddHandler in forum Programming / Datafeeds / Tools
    Replies: 8
    Last Post: April 17th, 2005, 02:11 AM
  4. Script to show text until $date
    By TJ in forum Programming / Datafeeds / Tools
    Replies: 3
    Last Post: November 23rd, 2004, 01:52 PM
  5. CGI Script Blocks Norton CJ Adds Show ??
    By jimmymac in forum Commission Junction - CJ
    Replies: 8
    Last Post: March 4th, 2004, 11:44 AM

Posting Permissions

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