Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Showing ads only to 20% percent of visitors. Or different ads to another 80% visitors
Old 07-31-2012, 03:45 AM Showing ads only to 20% percent of visitors. Or different ads to another 80% visitors
Skilled Talker

Posts: 90
Name: syu
Trades: 0
Hi guys, how to do this in a php file

Showing ads only to 20% percent of visitors. Or showing different ads to another 80% visitors

any way that can work, maybe using time intervals, like the visitors that visit the site at minute 0-12 only that show it, and visitors that visit the site at minute 13-59 is not. Or another methode

please help or share if you have, this should be easy enough and many people should need it, already googling it but still cant found it
__________________
Lets help each other

Last edited by basketmen; 07-31-2012 at 03:47 AM..
basketmen is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-31-2012, 12:13 PM Re: Showing ads only to 20% percent of visitors. Or different ads to another 80% visi
Physicsguy's Avatar
404 - Title not found

Posts: 1,060
Name: Scott Kaye
Location: Ontario
Trades: 0
I believe you can control the percentage of users that see what content in Google Analytics. Try clicking the Adwords/Adsense tab in GA and see what comes up. I don't have ads on any of my websites, so I can't really say this for sure, but I've definitely seen this type of thing before.
__________________

Please login or register to view this content. Registration is FREE
Physicsguy is offline
Reply With Quote
View Public Profile Visit Physicsguy's homepage!
 
Old 07-31-2012, 12:28 PM Re: Showing ads only to 20% percent of visitors. Or different ads to another 80% visi
chrishirst's Avatar
Defies a Status

Posts: 43,959
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Generate a random number in the range of 1 -100, if it is greater than 20 show the 80% set otherwise show the 20% set.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 07-31-2012, 02:52 PM Re: Showing ads only to 20% percent of visitors. Or different ads to another 80% visi
Physicsguy's Avatar
404 - Title not found

Posts: 1,060
Name: Scott Kaye
Location: Ontario
Trades: 0
Quote:
Originally Posted by chrishirst View Post
Generate a random number in the range of 1 -100, if it is greater than 20 show the 80% set otherwise show the 20% set.
But...but..but that's so much SIMPLER!
__________________

Please login or register to view this content. Registration is FREE
Physicsguy is offline
Reply With Quote
View Public Profile Visit Physicsguy's homepage!
 
Old 07-31-2012, 04:40 PM Re: Showing ads only to 20% percent of visitors. Or different ads to another 80% visi
miki86's Avatar
Extreme Talker

Posts: 239
Location: print_r($serbia);
Trades: 0
To be able to use any math here you'll need to know in advance how many visitors you'll get in a day

How is that possible?
miki86 is offline
Reply With Quote
View Public Profile
 
Old 07-31-2012, 05:00 PM Re: Showing ads only to 20% percent of visitors. Or different ads to another 80% visi
Physicsguy's Avatar
404 - Title not found

Posts: 1,060
Name: Scott Kaye
Location: Ontario
Trades: 0
Quote:
Originally Posted by miki86 View Post
To be able to use any math here you'll need to know in advance how many visitors you'll get in a day

How is that possible?
If you wanted to be very specific, then you would need to know the exact number of visitors you'll get that day. In other words, you'd need to create a psychic script, which obviously isn't possible. Chrishirst's solution would work like this:

Code:
$number = rand(1,100);

$_SESSION['showads] = $number;
//Then on every page load:
if($_SESSION['showads']>20){
//Show 80% ads
}
else ...
__________________

Please login or register to view this content. Registration is FREE

Last edited by Physicsguy; 07-31-2012 at 05:23 PM..
Physicsguy is offline
Reply With Quote
View Public Profile Visit Physicsguy's homepage!
 
Old 07-31-2012, 05:08 PM Re: Showing ads only to 20% percent of visitors. Or different ads to another 80% visi
miki86's Avatar
Extreme Talker

Posts: 239
Location: print_r($serbia);
Trades: 0
I think he meant showing ads to 20% of visitors, not 20% chance of showing ads

btw it shoud start with 1 not 0...rand(1,100)

Last edited by miki86; 07-31-2012 at 05:12 PM..
miki86 is offline
Reply With Quote
View Public Profile
 
Old 07-31-2012, 05:23 PM Re: Showing ads only to 20% percent of visitors. Or different ads to another 80% visi
Physicsguy's Avatar
404 - Title not found

Posts: 1,060
Name: Scott Kaye
Location: Ontario
Trades: 0
Quote:
Originally Posted by miki86 View Post
I think he meant showing ads to 20% of visitors, not 20% chance of showing ads
I know, but that's the only way to do it dynamically, without programming in an average number to calculate from.

Quote:
Originally Posted by miki86 View Post
btw it shoud start with 1 not 0...rand(1,100)
Woops, yeah. Fixed!
__________________

Please login or register to view this content. Registration is FREE
Physicsguy is offline
Reply With Quote
View Public Profile Visit Physicsguy's homepage!
 
Old 08-01-2012, 07:48 AM Re: Showing ads only to 20% percent of visitors. Or different ads to another 80% visi
King Spam Talker

Posts: 1,090
Name: Paul W
Trades: 0
I did a much more complicated set of rules using javascript and a cookie (site was mainly flat pages) - it's easy enough.
__________________
Great music:
Please login or register to view this content. Registration is FREE



Please login or register to view this content. Registration is FREE
PaulW is offline
Reply With Quote
View Public Profile
 
Old 08-01-2012, 08:49 AM Re: Showing ads only to 20% percent of visitors. Or different ads to another 80% visi
chrishirst's Avatar
Defies a Status

Posts: 43,959
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Quote:
Originally Posted by miki86 View Post
I think he meant showing ads to 20% of visitors, not 20% chance of showing ads
Sure:

But! As said previously, calculating an average of a unknown value is impossible, so we have to work with probability

There is:

A 1/100 probability of any particular number being the result.
A 80/100 probability of the number being >20 20)
A 20/100 probability of the number being < 20 <<< actually this should be 21 to include the value of 20

AND
QUOTE=miki86;1215720]I think he meant showing ads to 20% of visitors, not 20% chance of showing ads [/QUOTE]

My psuedo formula does say to show different sets of adverts NOT "do not display adverts" to one of the groups.

Although, in actual fact, the less than condition should be 21 to include the value of 20 as well.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?

Last edited by chrishirst; 08-01-2012 at 08:51 AM..
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 08-01-2012, 09:44 AM Re: Showing ads only to 20% percent of visitors. Or different ads to another 80% visi
miki86's Avatar
Extreme Talker

Posts: 239
Location: print_r($serbia);
Trades: 0
I agree probability is the only way to do it.
It wont be equal to 20:80 because without right values it can't be calculated to be precise but given the circumstances that won't be crucial, ads will be shown.
miki86 is offline
Reply With Quote
View Public Profile
 
Old 08-01-2012, 03:29 PM Re: Showing ads only to 20% percent of visitors. Or different ads to another 80% visi
chrishirst's Avatar
Defies a Status

Posts: 43,959
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
All things being equal, using probability will only need to be a start point, simply because the same script can start a "hit/shown" counting process and compare "real" counts against the probability results.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to Showing ads only to 20% percent of visitors. Or different ads to another 80% visitors
 

Thread Tools Search this Thread
Search this Thread:

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





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.33602 seconds with 11 queries