Refresh quiz ad units – why you should:
Quizzes are brilliant at getting your users to spend more time on site – with users spending an average of 3 minutes 17 seconds per ten question quiz. Now you can monetize that traffic by telling your site to refresh quiz ad units after every question. That will give you 10X the ad views for a typical quiz – neat, right?
The tech story:
Each quiz you create and embed is an isolated iFrame on your site. Normally, clicking ‘next’ after each question has no effect on the surrounding page.
We also recommend against telling your site to do a full page reload. This would reload the entire Riddle quiz at the same time and lose your user’s progress.
We have a script you can adapt that will tell your site to ‘listen’ for Riddle events, then use these events to refresh quiz ad units.
Check out this quiz example – just answer the questions and watch the surrounding ad unit reload.
Refresh quiz ad units – the tech details:
Ready to dive into the cool geeky details?
- We put the ad unit (in this case a Google AdSense ad) inside an iFrame.
- The iFrame has a unique ID called “google-ads-iframe”.
- The iFrame loads an external file containing the ad code.
- Every time this event occurs, it tells the ad iFrame to reload.
Refresh quiz ad units – our pro tips:
This solution isn’t perfect for every site. For example, if you monetize your traffic using ads that pay per click, this might not be a good idea – a fresh ad is not really going to get you more clicks.
However, if you are being paid by CPM (for every thousand ad views), this little script can make quite a difference in your monthly payouts.
Have more than one ad unit in each quiz?
Instead of adding the refresh line for all the different ad IDs, just give your ad frames a unique class. Then you just refresh all iFrames in that class – instead of telling your site to refresh quiz ad units by individual ad ID.
Refresh quiz ad units – ready to use code:
Here some sample code you can use – just make sure to:
- Load JQuery first
- Replace #google-ads-iframe in 2 places with the ID of your iFrame containing the ads
- Actually put your ad code into an iFrame. (If it is not in an iFrame, this method won’t work.)
Don’t want to use jQuery? No worries – we have a good alternative.
- Simply use the code below
- Make sure to enter the correct iFrame ID
Refresh quiz ad units – WordPress
This example works really well when you embed your quiz in WordPress. Just a couple things to remember:
- The ad unit needs to run inside an iFrame.
- To make this work, create a new html file with the ad code in it.
- Save this in a new sub directory below your document root on your web server.
- (You will need FTP access to your server for this.)
To place your ads on your page or in your side bar – load the ad code like this (this code loads a 300×250 pixel LREC ad unit):
- Now, switch to the text editor of the post or page where you got your Riddle.
- Place that ad iFrame code where you want to load the ad.
- At the bottom of your page, place our handy refresh quiz ads script from above.
Want to see this in action? Check out our Pastafun.com site – where we demo the ad refresh inside WordPress.
Can we help?
Don’t worry if trying to refresh quiz ad units sounds a little technical.
Use our support chat on Riddle or email us at firstname.lastname@example.org – we’re big customer service geeks, and race each other to answer customer questions. 🙂