A Custom, Easy-to-Use Popunder Script Perfect for SPLIT TESTING

Published by Papa Whale Webmaster

Check out this awesome, highly customizable popunder script that allows you to promote and Split Test multiple campaigns! We’re sharing the code.

CR_BLOG_605x300_popunderscript

Be it banners or campaigns — one thing we’ve talked a lot about at CrakRevenue has been the importance of split testing.

Split testing (also known as A/B testing) has been defined as a method of conducting “controlled, randomized experiments” with the ultimate goal of seeing what converts the best.

But what’s a good automated way of doing this?  Well, one way is through javascript!

Today, for the first time ever, we’re sharing a custom, easy-to-use popunder script that will allow you to split test as many CrakRevenue offers as your heart desires!  

The story behind the script

First, we’d like to thank our friend Lan at TitsPlz.com for this collaboration.  

Lan’s a longtime webmaster, programmer, and CrakRevenue affiliate to boot! Over the last couple of years, we took notice of his custom modified popunder rotation script.

We liked it so much—we asked Lan if we could feature it on our blog.

While a large portion of the popunder code stems from the Internet, Lan’s modifications—as well as a tweak or two from our dev team—are what makes this popunder script so special and perfectly tailored to the average CrakRevenue webmaster & affiliate.

For anyone looking to split test or promote multiple offers at once on one’s website, this is an essential tool to have simply for the automated A/B testing rotational elements.

The JS

The popunder rotational script contains two components:

1. The .js file… “lanund.js” 

The lanund.js code can be viewed and downloaded here at Pastebin

2. The script you include on the web page

The full script that you will include in your HTML can be viewed and downloaded here at Pastebin.

lanund.js

The script you include on the web page

URL list

URLlist = [
[“http://Site1.com“, 10], // first column is URL, second column is the relative weight
[“http://Site2.com“, 70], // since the total weight is 100, this will happen 70% of the time
[“http://Site3.com“, 10],
[“http://Site4.com“, 10] // last element doesn’t get a comma
];

This is where the Split Testing element comes into play.

In the code and in our above example, we’ve chosen to promote 4 different URLs, with a specified weight for each one.

In our example, Site2 is favored here, so by putting the 70 next to it, out of these 4 URLs, the popunder will display Site2 70% of the time unless changed.

If you want to promote 10 different CrakRevenue offers with an equal weight, it would look something like this:

URLlist = [
[“http://Site1.com“, 10],
[“http://Site2.com“, 10],
[“http://Site3.com“, 10],
[“http://Site4.com“, 10],
[“http://Site5.com“, 10],
[“http://Site6.com“, 10],
[“http://Site7.com“, 10],
[“http://Site8.com“, 10],
[“http://Site9.com“, 10],
[“http://Site10.com“, 10] // last element doesn’t get a comma
];

Putting it all together…

When all is said and done, this is how the popunder code might look in your HTML document (once you’ve saved the lanund.js file to your server).

Protip:  the script should be placed right before the closing </body> tag.

Good luck everyone!  Let us know how you do with the Split testing and how you like the code.

And don’t hesitate to comment if you have any questions along the way!

  • Wizzardsz

    Great share it works correctly in some browsers but, in Chrome it opens a Pop Up instead of Pop Under, haven’t tried it in Firefox yet, it would be awesome if you can offer a fix for this 🙂

    • CrakRevenue

      Hi Wizz,

      Unfortunately, you’re right, it may not work perfectly in all browsers as browser versions are always changing.

      The appeal here, however, is definitely the general Link/URL rotation element and its ease of use on anyone’s website. We really liked that about this script and that’s one of the main reasons we wanted to make it available to the non-programmer types.

      If anyone has a fix or modification, we of course encourage you to comment!

      • Wizzardsz

        Overall it’s a nice script it helps a lot to test different offers, i know nothing about programming so you sharing it was perfectly timed thanks again.

  • I think this is a good method of testing people using pop ups on their websites

  • himandherdaily.com

    Definitely working on the chrome script. It seems to have a mind of its own 🙂
    Firefox & Safari works great!

  • We’ve been using a very similar script for years without the weight option. Nice. Cant wait to give this one a try. Thanks my nigga.

  • simplyDIE

    Question:
    How do you add this to a wordpress site?
    I’m assuming we upload the JS to the domain on the server, but do we add the HTML code to the bottom of the MainIndex file or…?

    • CrakRevenue

      Hi Simply,

      To answer your first question:
      It depends, but typically you’d add it to the JS directory of your WordPress theme. However, this may mean adding some code as well.

      For any regular site/domain situation, all you have to do is ensure that the .JS is hosted somewhere. It doesn’t necessarily matter where you host the .js (it makes sense to host it on the domain you’ll be using, but as long as you can load the script, it doesn’t matter if it’s on another domain, for example).

      ” ” would work loading the script

      Be sure to check out our screenshot here how it looks all together in the HTML ( http://blog.crakrevenue.com/wp-content/uploads/2016/06/filezilla-Lans-thingy.png ).

      The script should be placed right before the closing tag.

      Hope this helps! Best of luck!

  • Fabien Blanchet

    Hello,

    To open a popup adjusted to full screen size , just add on lanund.js :

    Line 12 :
    var WidthScreen = screen.width;
    var HeightScreen = screen.height;

    In “var sOptions = ‘… … … ‘ (line 50 approximately )
    Replace :
    + height.toString() +
    and
    + width.toString() +
    By:
    + HeightScreen +
    + WidthScreen +

    Better ratio conversion … 🙂

  • Valentin Cavelier

    Hey, thanks for the script it’s really awesome!

    I have a problem though…

    I installed it on two different wordpress sites (landing pages created with Instabuilder 2.0) and on one site it’s working fine, loading the pop under properly.
    BUT on the other page, it loads the window on top of my main window, making it a pop up…

    I copied the exact same scripts on both pages, with the exact same lanund.js file in each directory…

    Been spending one hour on this and I can’t find anything…

    Any help please ?

  • Artem

    Hey, thanks for script. But it works like pop-up, not pop-under..

  • Cris Griffith

    Very nice! I am going to make a WordPress plugin using this. Will be sure to give credit where due!

  • Thiago Dias

    there’s some way it could open 2 urls at once? great tutorial btw!

    • Possible with two clicks, but not with one.

  • ssbcrack

    Hi, using your wordpress plugin, keep three different pop up and they are working as per the priority but it is opening additional blank pop up pages which are blocked by chrome, any idea why it is opening blank pages?

  • ssbcrack

    why it is opening two extra about:blank page chrome?

  • Thanks for publish such a wonderful article.

    Regards

    Shah

Latest POSTS