p202 landing-page code

Print a landing page's tracking code (Setup > Get LP Code)

Web UISetup › Get LP CodeNew in 1.9.77
All commands

01Jobs it does

Each one is a real command line. Copy it, or open it in the builder below to change it.

landing page code

Also: landing page tracking script, lp code

p202 landing-page code <id>
Web UISetup › Get LP Code

02What you get

Captured from the real binary, run against a demo store with 30 days of traffic. Switch tabs to see the same run as JSON, the shape scripts and agents parse.

p202 landing-page code 1
$ p202 landing-page code 1
Landing page 1 "Spring Lookbook" (simple): https://example.com/lookbook/spring
Test every link yourself before you run traffic to it.

1. Landing page code
Put this right above the </body> tag of ONLY the page your visitors first arrive on, not in a template every page of the site includes.

<script>
	(function(d, s) {
		var upxf = d.getElementsByTagName(s)[0], load = function(url, id) {
			if (d.getElementById(id)) {return;}
			var if202 = d.createElement("script");if202.src = url;if202.async = true;if202.id = id;
			upxf.parentNode.insertBefore(if202, upxf);
		};
		var t = new URLSearchParams(window.location.search).get("t202id") || "";
		load("//track.example.com/tracking202/static/landing.php?lpip=212&t202id=" + encodeURIComponent(t), "upxif");
	}(document, "script"));
	</script>

2. Link out to the offer: choose one of the three.

Option 1: outbound redirect link (use it as the link to the offer on your page)
//track.example.com/tracking202/redirect/go.php?lpip=212

Option 2: outbound PHP redirect (save it as a page on your site, e.g. redirect.php, and link to that page; cloaks your affiliate link)
<?php

  // -------------------------------------------------------------------
  //
  // Tracking202 PHP Redirection, created on Fri Oct, 2026
  //
  // This PHP code is to be used for the following landing page.
  // https://example.com/lookbook/spring
  //
  // -------------------------------------------------------------------

  if (isset($_COOKIE['tracking202outbound'])) {
	$tracking202outbound = $_COOKIE['tracking202outbound'];
  } else {
	$tracking202outbound = '//track.example.com/tracking202/redirect/lp.php?lpip=212&pci='.$_COOKIE['tracking202pci'];
  }

  header('location: '.$tracking202outbound);

?>

Option 3: outbound JavaScript redirect (a page that lets other tracking tags fire before the visitor leaves)
<!DOCTYPE html>
<html>
<head>
	<title>GO</title>
</head>
<body>

<!-- PLACE OTHER LANDING PAGE CLICK THROUGH CONVERSION TRACKING PIXELS HERE -->

<!-- NOW THE TRACKING202 REDIRECTS OUT -->
<script type="text/javascript">
if (readCookie('tracking202outbound') != '') {
	window.location=readCookie('tracking202outbound');
} else {
	window.location='//track.example.com/tracking202/redirect/lp.php?lpip=212';
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return urldecode(c.substring(nameEQ.length,c.length));
	}
	return false;
}

function urldecode(url) {
	  return decodeURIComponent(url.replace(/\+/g, ' '));
}
</script>
</body>
</html>

Dynamic content: the loader fills any element named after one of these, e.g.
  <span name="t202Country" t202Default="Your Country">Your Country</span>
  t202Country       Visitor's Country
  t202CountryCode   Visitor's Country Code
  t202Region        Visitor's Region/State
  t202City          Visitor's City
  t202Postal        Visitor's Postal/Zip Code
  t202Browser       Visitor's Browser
  t202OS            Visitor's Operating System
  t202Device        Visitor's Device Type
  t202ISP           Visitor's ISP
  t202kw            Value passed in t202kw
  t202c1            Value passed in C1
  t202c2            Value passed in C2
  t202c3            Value passed in C3
  t202c4            Value passed in C4
  t202utm_source    Value passed in utm_source
  t202utm_medium    Value passed in utm_medium
  t202utm_term      Value passed in utm_term
  t202utm_content   Value passed in utm_content
  t202utm_campaign  Value passed in utm_campaign
Real output · p202 1.9.77 · demo dataexit 0

03Build your command

Pick values and the command line writes itself, quoted and ready to paste.

p202 landing-page code

Set flags below; the command updates as you type.

04Flags

1 flag, plus the global flags every command takes.

FlagWhat it does
--offerstringSliceAn advanced page's offer, campaign:ID or rotator:ID; repeat the flag (or comma-separate) for each, in order

05How it works

Prints what Setup > Get LP Code hands out for the landing page: the script to put above </body> of the page visitors arrive on, and the ways out to the offer.

A simple page (landing_page_type 0) links out to its own campaign: an outbound link (go.php?lpip=), a PHP redirect page, or a JavaScript redirect page. An advanced page (landing_page_type 1) links out to each offer you name, in order: --offer campaign:<id> a campaign (p202 campaign list), via go.php?acip= --offer rotator:<id> a redirector (p202 rotator list), via go.php?rpi= each with its own outbound link and PHP redirect page.

The links are scheme-relative (//host/...), as the page writes them, so they work on an http or an https landing page. Accepts the internal landing_page_id, or the public id the code carries (lpip=). Needs a role with access_to_setup_section.

06For agents

Running this from an agent

  • Read the same facts as JSON: p202 commands landing-page code --json.
  • With AI_AGENT, CLAUDECODE or another agent variable set, output is compact JSON and errors arrive on stderr as a JSON envelope with a hint.
  • Exit codes: 0 ok, 1 bad input, 2 auth, 3 network, 4 server error, 5 partial failure.
p202 commands landing-page code --json
{
  "path": "p202 landing-page code",
  "use": "code <id>",
  "short": "Print a landing page's tracking code (Setup > Get LP Code)",
  "long": "Prints what Setup > Get LP Code hands out for the landing page: the script to put\nabove </body> of the page visitors arrive on, and the ways out to the offer.\n\nA simple page (landing_page_type 0) links out to its own campaign: an outbound link\n(go.php?lpip=), a PHP redirect page, or a JavaScript redirect page.\nAn advanced page (landing_page_type 1) links out to each offer you name, in order:\n  --offer campaign:<id>  a campaign (`p202 campaign list`), via go.php?acip=\n  --offer rotator:<id>   a redirector (`p202 rotator list`), via go.php?rpi=\neach with its own outbound link and PHP redirect page.\n\nThe links are scheme-relative (//host/...), as the page writes them, so they work on\nan http or an https landing page. Accepts the internal landing_page_id, or the public\nid the code carries (lpip=). Needs a role with access_to_setup_section.",
  "runnable": true,
  "example": "p202 landing-page code 12\n  p202 landing-page code 14 --offer campaign:3 --offer rotator:2\n  p202 landing-page code 14 --offer campaign:3,campaign:5 --json",
  "tasks": [
    {
      "run": "p202 landing-page code",
      "ui_pages": [
        "Setup › Get LP Code"
      ],
      "phrases": [
        "landing page code",
        "landing page tracking script",
        "lp code"
      ]
    }
  ],
  "flags": [
    {
      "name": "offer",
      "type": "stringSlice",
      "default": "[]",
      "usage": "An advanced page's offer, campaign:ID or rotator:ID; repeat the flag (or comma-separate) for each, in order",
      "required": false
    }
  ]
}