Notices
Reply

Thread: Script (PHP?) to track IP and not show same content to same IP twice.

 
Tools Search
  #1  
Old December 7th, 2011, 10:05 PM
ABW Ambassador
Join Date: June 30th, 2007
Location: Syracuse, NY
Posts: 677
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  
Old December 8th, 2011, 04:06 AM
Full Member
Join Date: November 21st, 2010
Posts: 220
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  
Old December 8th, 2011, 05:02 AM
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.
Join ABW to remove this sponsored message.
  #4  
Old December 8th, 2011, 05:08 AM
Full Member
Join Date: November 21st, 2010
Posts: 220
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.
Thanks From:
  #5  
Old December 8th, 2011, 05:22 AM
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!
  #6  
Old December 8th, 2011, 11:35 AM
Full Member
Join Date: November 21st, 2010
Posts: 220
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.
Join ABW to remove this sponsored message.
  #7  
Old December 8th, 2011, 11:48 AM
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.
  #8  
Old December 8th, 2011, 12:58 PM
Full Member
Join Date: November 21st, 2010
Posts: 220
Won't really affect speed/performance, but you're entering into privacy areas with cookies. I'd just google it.
  #9  
Old December 8th, 2011, 01:25 PM
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.
Join ABW to remove this sponsored message.
  #10  
Old January 18th, 2012, 03:03 AM
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.
  #11  
Old February 15th, 2012, 12:37 PM
Member
Join Date: March 26th, 2010
Location: Irvine, CA
Posts: 37
Send a message via Skype™ to soda
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.
__________________
Itemscope
Reply

Tools Search
Search:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting video content to show bluedogs Introduce Yourself 0 February 26th, 2009 12:06 AM
Keeping track of IF in PHP itsupportnotes Datafeeds 16 April 21st, 2008 03:29 PM
Show Text One Time via PHP AddHandler Programming / Datafeeds / Tools 8 April 17th, 2005 01:11 AM
Script to show text until $date TJ CGI and PHP Programming 3 November 23rd, 2004 12:52 PM
CGI Script Blocks Norton CJ Adds Show ?? jimmymac Commission Junction 8 March 4th, 2004 10:44 AM


Content Relevant URLs by vBSEO ©2011, Crawlability, Inc.