Script Tutorials

In the docs

These scripts are retained for older setups.

This page includes three scripts: iFrame, Dynamic Keyword Insertion, and Page Load Time Analysis.

iFrame Script

This example loads an offer in an iframe with Prosper202 ClickServer tracking. Replace your-tracking-domain.com with the domain ClickServer runs on, plus its folder if you installed it in one, and replace XXXXXX with your landing page's ID: the number after lpip= in the landing page code from Step 7. Place the JavaScript at the end, and have the iframe src set to the landing page outbound link, not the PHP redirect code.

<html>
 	<head>
 	<title>Title Goes Here</title>
 	</head>
 	<body style="margin: 0px; padding: 0px;" scroll="no">
 	<iframe src="https://your-tracking-domain.com/tracking202/redirect/go.php?lpip=XXXXXX" style="border: 0px; width: 100%; height:100%;"></iframe>
 	<script src="https://your-tracking-domain.com/tracking202/static/landing.php?lpip=XXXXXX"></script>
 	</body>
</html>
To show the offer in an iframe after the landing page, link visitors to a second page on your domain. That page loads the offer in an iframe rather than redirecting the browser to the offer's domain.

Adapt the Simple or Advanced LP redirect code to set the iframe's src. Instead of calling header() to redirect the visitor, the example stores the outbound URL for use in the iframe:

<?php
  
//$tracking202outbound is where the user is supposed to be redirected to
  if (isset($_COOKIE['tracking202outbound'])) {
    $tracking202outbound = $_COOKIE['tracking202outbound'];
  } else {
    $tracking202outbound = 'https://your-tracking-domain.com/tracking202/redirect/lp.php?lpip=XXXXXX'
      . '&pci=' . urlencode($_COOKIE['tracking202pci'] ?? '');
  }

?>

Further down the same .php file, print that URL as the iframe src. htmlspecialchars() escapes it so it is safe to print inside the tag:

<html>
 <head>
 <title>Title Goes Here</title>
 </head>
 <body style="margin: 0px; padding: 0px;" scroll="no">
 <iframe src="<?php echo htmlspecialchars($tracking202outbound, ENT_QUOTES, 'UTF-8'); ?>"
 style="border: 0px; width: 100%; height:100%;"></iframe>
 </body>
</html>

Putting Dynamic Keywords in your Landing Pages

This PHP example reads the keyword from the landing page URL and displays it in the page title and content.

Landing Page Code

<?php

//grab the t202 keyword, escaped so it is safe to print on your page
$keyword = htmlspecialchars($_GET['t202kw'] ?? '', ENT_QUOTES, 'UTF-8');

//now anywhere we call echo $keyword, it will display the dynamic kw!

//extra goodie, uncomment the line below if you would like to capitalize 
//the first character in each word
//$keyword = ucwords(strtolower($keyword)); 

?>

<html>
 <head>
 <!-- Display the Dynamic Keyword in the Title! -->
 <title><?php echo $keyword; ?></title>
 </head>
 <body>

 <!-- Display the Dynamic Keyword in the body's content! -->
 This is the content on my landing page! You were searching for <?php echo $keyword; ?>.

 </body>
</html> 
Use <?php echo $keyword; ?> in the PHP file wherever you want to display the keyword.

Landing Page Load Time Analysis

This script measures how long the server takes to generate a page and displays the result at the bottom. It does not measure the time needed for the visitor's browser to download and display the page.

Landing Page Code

<?php $microtimer = microtime(true); /*set the timer, this is to be placed at the top! */ ?>

<html>
 <head>
 <title>Title</title>
 </head>
 <body>
 
 Blah Blah Blah, this is my content!
 
 <?php //print on the screen how long this page took to load
 $seconds = microtime(true) - $microtimer;
 echo 'This page took ' . round($seconds, 3) . ' seconds to load.'; ?>
 
 </body>
</html> 
The result appears at the bottom as: This page took xxxxx seconds to load.