Optimize Like a Pro with CPV Lab ad tracker!
Get deeper insights, precise tracking, A/B split testing, bot filtering, and API integrations to optimize audiences automatically. Start tracking!

Guide Your own onclick popunder script

OpenAFF

Luke

Admin
Staff Member
Community Leader
Joined
Apr 17, 2018
Messages
24,487
Alright, so I found this JavaScript years and years ago. I'm honestly not sure on the exact year. Maybe 2014? Anyway, I used it on some viral sites I had to generate my own popunders. I found the script the other day in a swipe file and tested it out and it still works!

So, if you want to try it out, feel free :)

It will generate a pop-under on your landing page when something is clicked.

Main JavaScript (I recommend creating a separate file with this called pop.js or something):

JavaScript:
(function (window)  {
    'use strict';
     var
         userAgent  = navigator.userAgent.toLowerCase(),
         thisUrl = window.location.href,
          referrerUrl = document.referrer,
         baseName  = 'plug',
         counter = 0,
          cookieName = "_plug",
         makeInterval  = 1 , //minutes
         maxCap  = gtp["raw"], // base but overwritten
          keepCookie = 60*24, // minutes
          trafficType = gtp["traffic"],
         mobile  = {
              true: /iphone|ipad|android|ucbrowser|iemobile|ipod|blackberry|bada/.test(userAgent)
         },
          browser = {
              win: /windows/.test(userAgent),
              mac: /macintosh/.test(userAgent),
              mobile: /iphone|ipad|ucbrowser|iemobile|ipod|blackberry|bada/.test(userAgent),
              android:  /android/.test(userAgent),
              ios:  /iphone|ipad|ipod/.test(userAgent),
              webkit: /webkit/.test(userAgent),
              mozilla: /mozilla/.test(userAgent) &&  !/(compatible|webkit)/.test(userAgent),
              chrome: /chrome/.test(userAgent),
              msie: /msie|trident\//.test(userAgent) && !/opera/.test(userAgent),
              firefox: /firefox/.test(userAgent),
              safari:  /safari/.test(userAgent) && !/chrome/.test(userAgent),
              opera: /opera/.test(userAgent),
              version: parseInt(userAgent.match(/(?:[^\s]+(?:ri|ox|me|ra)\/|trident\/.*?rv:)([\d]+)/i)[1], 10)
          },
         targetElement = null,  // base but overwritten
         url  = "https://yourtrackingdomain.com/click",
 
Last edited:
To view the premium content in our affiliate marketing forum (including this awesome thread), you must first register and upgrade your account. Register today and become a part of our amazing community!
Top