JohnnyDoomo Posted February 5, 2012 Share Posted February 5, 2012 I'm thinking of getting ads to refresh on my site ever couple of minutes. I'm thinking of going with ajax, but I would need a programmer for this, versus iframes, which I could do. Some of my concerns are if there are pluses or minuses to each? For example, what if the ad code isn't designed to open a new window when clicked? It would load the ad page within the iframe. I'm not sure if there is any way around this when it's ad code from a 3rd party ad company.(I know many of ad companies offer the choice, but I'm still concerned.) Also, if I use ajax, is it still possible to use a companies ad code that is javascript itself? (as it would need to run inside my own ajax code.) Do people have suggestions on this? Quote Link to comment https://forums.phpfreaks.com/topic/256438-difference-between-ajax-iframe-ad-rotator/ Share on other sites More sharing options...
Drongo_III Posted February 29, 2012 Share Posted February 29, 2012 I'm not entirely sure what you're after here. But would it not make more sense pre-load in a random selection of ads on page load? I suggestion this for two reasons: 1) What is the average time a user spends on one of your pages? I bet it's not much over 2 mins so refreshing ads via ajax is a bit pointless. 2) Imagine an average person on your site. They visit, they might sit on a page and leave their browser open whilst doing something else (anywhere from a few minutes to a few hours). If that was happening for hundreds/thousands of users you'd end up making server requests via ajax every two minutes for each person - presenting users with ads when they aren't even there to see them. So you're tying up your server resources for absolutely no benefit. Personally i would preload in a range of ad urls to a javascript array and then use some other javascript/jquery to cycle them on a periodic basis. Drongo Quote Link to comment https://forums.phpfreaks.com/topic/256438-difference-between-ajax-iframe-ad-rotator/#findComment-1322335 Share on other sites More sharing options...
JohnnyDoomo Posted February 29, 2012 Author Share Posted February 29, 2012 1. Users are on my pages for hours at a time. 2. Preloading ads doesn't seem like it would work, as I don't know how long a user is going to be on my site. Using more server resources isn't a big issue, but taking advantage of long time that users stay on a single page is. I'm simply trying to make enough money to make the current ad placements worth while, and it seems like the one thing to take advantage of for my site and the length of time users spend on pages, is to show them new ads every 5, 10 or 20 minutes. I'm fairly certain I want to use ajax or an iframe, but it seems like ajax is the slicker way to do it. Since I'm not a programmer tho, I'm concerned if this would have problems as the ajax would be rotating different ad companies ad code. Thoughts? Quote Link to comment https://forums.phpfreaks.com/topic/256438-difference-between-ajax-iframe-ad-rotator/#findComment-1322363 Share on other sites More sharing options...
Drongo_III Posted February 29, 2012 Share Posted February 29, 2012 Well entirely your choice and you know your site better than i do. I would seriously consider not using ajax for this though if you have a standard website. As i dont fully understand your setup I can't see how you'd make this work with iframes. Unless you intend to iframe in content from companies who will themselves handle all the coding their end? How exactly do companies provide their ad code to you? Presumably companies provide you with some ad creative and a url? 1. Users are on my pages for hours at a time. 2. Preloading ads doesn't seem like it would work, as I don't know how long a user is going to be on my site. Using more server resources isn't a big issue, but taking advantage of long time that users stay on a single page is. I'm simply trying to make enough money to make the current ad placements worth while, and it seems like the one thing to take advantage of for my site and the length of time users spend on pages, is to show them new ads every 5, 10 or 20 minutes. I'm fairly certain I want to use ajax or an iframe, but it seems like ajax is the slicker way to do it. Since I'm not a programmer tho, I'm concerned if this would have problems as the ajax would be rotating different ad companies ad code. Thoughts? Quote Link to comment https://forums.phpfreaks.com/topic/256438-difference-between-ajax-iframe-ad-rotator/#findComment-1322412 Share on other sites More sharing options...
JohnnyDoomo Posted February 29, 2012 Author Share Posted February 29, 2012 I use ad companies, so similar to Google's adsense, I just insert the code (javascript) and they handle the rotation as pages are refreshed... or in this case, when the code is called again. Doing it in iframes is easy, just set the iframe html page to refresh at the rate that I want. It's that I don't know if Ajax would be better or run smoother. Quote Link to comment https://forums.phpfreaks.com/topic/256438-difference-between-ajax-iframe-ad-rotator/#findComment-1322442 Share on other sites More sharing options...
Drongo_III Posted March 1, 2012 Share Posted March 1, 2012 Ahh well i can't be of much help in that case sorry :/ I would have thought using ajax to prompt the ad server into refreshing your ads sounds reasonable - but that's assuming a server setup exists to allow you to do this. I use ad companies, so similar to Google's adsense, I just insert the code (javascript) and they handle the rotation as pages are refreshed... or in this case, when the code is called again. Doing it in iframes is easy, just set the iframe html page to refresh at the rate that I want. It's that I don't know if Ajax would be better or run smoother. Quote Link to comment https://forums.phpfreaks.com/topic/256438-difference-between-ajax-iframe-ad-rotator/#findComment-1322784 Share on other sites More sharing options...
JohnnyDoomo Posted March 1, 2012 Author Share Posted March 1, 2012 Are you saying that the 3rd party ad company would need to support it? I thought if I used ajax that all I needed was ajax to "call" the ad code again, and ajax keeps the page from entirely refreshing, as it's just "recalling" the ad code again. If people that know how ajax works could confirm or deny this, it would help me greatly, as I don't want to pay a programmer to code ajax for all my ads, only to find out that it won't work. Thanks for any info others can provide on this. Quote Link to comment https://forums.phpfreaks.com/topic/256438-difference-between-ajax-iframe-ad-rotator/#findComment-1322930 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.