Refresh quiz ad units after each question

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?

refresh quiz ad units

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.

Our solution?

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

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.
  • The Javascript code listed below listens for a Riddle event – in this case, each time the Riddle goes to the next screen.
  • 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?

Time-saver:

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.)

Refresh quiz ad units – JavaScript version:

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.
  • Not using jQuery on your site (or to be safe if you are not sure) use our simple JavaScript code snippet.

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 hello@riddle.com – we’re big customer service geeks, and race each other to answer customer questions. 🙂

 

By | 2017-03-15T16:03:37+00:00 February 24th, 2017|

About the Author:

I want to build a network of creators who build fun and viral content to grow their traffic and to entertain their readers. Starting companies and helping others to set up shop has always been my passion. With Riddle I can do both as our Riddles have already helped many websites to grow their traffic and revenue. Give us a try and let me know if there is anything we can do better.

Leave A Comment