Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Inject an ad spot in place of image every X images  (Read 2736 times)

0 Members and 1 Guest are viewing this topic.

Rowdy

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Inject an ad spot in place of image every X images
« on: December 30, 2013, 09:05:27 pm »

I am using picture navigation with intermediate images as the main way to browse a photo gallery. What I would like to figure out is how to inject an ad spot IN PLACE of an intermediate image, every X images and/or perhaps at the end of the gallery. So if I chose every 5th image, you would see photos 1 - 4, then the next would take you to an ad display, then the next would take you to image 5 and so on. I would not use this for Adsense, but for other networks or banners or local promotions.

I also welcome suggestions for the gallery and the site.
http://lesharorv.com/gallery/displayimage.php?album=10&pid=28#top_display_media

Logged

Rowdy

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: Inject an ad spot in place of image every X images
« Reply #1 on: January 03, 2014, 03:41:51 am »

I have found some success. I found access to the PID variable by assigning it in theme.php before the EOT:

$pid = $superCage->get->getInt('pid');  read more

and then referencing it from the template within javascript that toggles display from none to block and then running the ad code below.

if ({$pid} % 5 === 0) {
 var mydiv = document.getElementById('adbox');
    mydiv.style.display = 'block'
  }

If the above is true, and javascript is enabled, the ad spot will display every 5 photos. If javascript is disabled, the DIV stays display:none;
This ad spot is much better than something to the side of the photo. And I am not going to use Adsense here as there is rarely context for the bots. I can do some additional magic and cycle through other ad networks and even my own ad spots. I have found a lot of success on my niche sites by displaying related ebay and amazon products. So I typically random cycle through keyword lists of search terms.

Definitely interested in peoples thoughts on this. I am surprised there is no plugin yet to do this sort of thing, perhaps without javascript.

http://lesharorv.com/gallery/displayimage.php?album=10&pid=25#top_display_media

Logged

gmc

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 785
    • GMC Design Photo Gallery
Re: Inject an ad spot in place of image every X images
« Reply #2 on: January 03, 2014, 05:20:45 am »

I followed your link, and scrolled thru the 35 pictures.
I received a pop-up ad over photos 1,5,9,11,20,24,25 - then nothing thru 35.

Personally I would have left the site by photo 11 - after having to close 4 windows that took much longer to load than normal pages, and 3 of the 4 ads (and more on later pages) trying to sell me the same 2 products I already bought from that vendor in the last two weeks.

But I dislike pop up ads...  :D - see what others say.
Logged
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

Rowdy

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: Inject an ad spot in place of image every X images
« Reply #3 on: January 03, 2014, 05:42:44 am »

I think of it as an experiment for now. Nobody likes popups of course. I can tweak the numbers higher and could also look at different formats such as a leaderboard across the bottom perhaps. I am wondering if there is any good way to monetize a photo gallery really. I suspect those using adsense on every photo arent adding positively to their adsense stats.
Logged
Pages: [1]   Go Up
 

Page created in 0.018 seconds with 20 queries.