Expand performance marketing, reach new audiences, and grow your business

Guide How to Centralize Your Landing Page Scripts in 1 File

MGID Contest

Nick

🧙🏻‍♂️ Wizard 🔮
Staff Member
Community Leader
Joined
May 7, 2018
Messages
4,571
In this guide, I’m going to show you how you can centralize your landing page scripts so that when you need to make changes you can do it in 1 place instead of on every single landing page you have separately.

This isn’t something that’s required if you’re using landing pages, but if definitely makes your life 200% easier. I’ve also had a few people ask me about how to do this, so I thought it would be good to make it as a guide for others.

Let’s get started.

Make a Javascript File with All Your Scripts​

The first thing you’re going to want to do is make a Javascript file with all of the landing page scripts you typically use. This might be the back button script, a push script, and whatever else you like to use on your landing page to get those juicy conversions.

For this example, let's say it looks something like this:

JavaScript:
// Get URL  Params
function getURLParameter(name) {
  return decodeURIComponent((RegExp(name  + '=' + '(.+?)(&|$)').exec(location.search) || [,  null])[1] || '');
}

// Propush
if (!getURLParameter('push')) {
   var s = document.createElement('script');
   s.src = '//oungimuk.net/act/files/micro.tag.min.js?z=1234567' + '&sw=/sw-check-permissions-c123e.js';
   s.onload = function (result) {
     switch (result) {
       case 'onPermissionDefault':
 
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