Tracking WordPress Landing Pages With Prosper202

It’s no secret that many people use wordpress for landing pages.  It’s a very versatile CMS that’s easy for a novice to set up, has many templates, is free, etc.  Realistically, you could have a decent landing page with content up and running in a couple hours with no problem if you’re using wordpress and not too worried about looking very professional.  There’s no reason to go much further into this concept as Nickycakes already laid it out pretty well in his post, Affiliate Product Blogs.  Great, so once you’ve set up your landing page, how do you set up tracking on it?

Nickycakes loves using Prosper202 for tracking any ppc campaigns because it simply does pretty much everything you could possibly ask for in terms of tracking, and it’s completely free.  It doesn’t hurt that the guy who runs it makes himself available almost 24/7 for questions and troubleshooting either!  It’s got great shiny ajax graphs and stuff that make it really visually pleasing to not only see how much cash you’re raking in and what kinda roi you’re getting for each keyword, but have it look goood.  This isn’t going to be a tutorial on how to set up prosper202 on your own hosting, and you can use their hosted solution, tracking202, which is also free, but worries many because the people running it, if they wanted, could potentially steal all your successful campaign data.

Ok, so you have prosper202 set up properly and whatnot, and you want to make a ppc campaign with a wordpress landing page.  Prosper202 makes it easy to use a landing page by simply asking you to paste some javascript code at the bottom of your page.  Unfortunately, with wordpress, you can’t put the javascript in the footer of the page without editing the wordpress template, and even then, the javascript will then be put on ALL the pages on the wordpress page, which means you won’t be able to properly set up a different wordpress post for each of your landding pages in order to split test different copy, etc.  Not ideal to say the least.  Many people use 10 or more nearly identical landing pages on a wordpress site for split testing purposes, sending different traffic sources to different landing pages, etc.  So how can you set up your wordpress with prosper202 to track this properly?

Well, it’s pretty easy with a little php and knowledge of wordpress functions.  Basically what you want to do is tell wordpress to display a different javascript code in the footer of each of your individual wordpress posts.  So after creating your wordpress landing page, you’ll need to know the post number.  When you go to make your campaign in prosper202, you will want to set up your PPC Account, Affiliate Network, Affiliate Campaign, Landing Page (using the individual post url for the lp you just created in wordpress), and text ad.  Then when you go to Get LP Code, p202 will give you a piece of javascript to put on the LP and some PHP code for the outgoing redirect.

To put the javascript on your landing page, you need to edit your wordpress template that you’re using (hopefully you know how to do that) and specifically edit the footer (probably something like footer.php).  You’re going to be adding a line of code right before the closing body tag, </body>.  It will look something like this:

<?php if(is_single(’10′)){echo “<script src=\”\” type=\”text/javascript\”></script>”;} ?>

Please note that you need to change the is_single part to reflect the post number of your landing page.  Also the exact javascript you’re using will have a different url in it, and you will need to put the backslashes before the quotation marks in the javascript code.  Basically all this is doing is telling wordpress, “hey, if someone’s looking at post #10, display this javascript code before the closing body tag.

After you’ve done that, you’ll need to either point all the links to the offer on your landing page to the link that p202 gives you, OR create a php file that you will link to which will redirect the users to the offer.  If you choose to go the php redirect route, which in Nickycakes’ opinion, looks a little better to the customer  (not that much better as most customers willing to buy your affiliate products will be too stupid to know the difference), then you will need to create a file and paste the php code that p202 gives you inside.  In order to keep track of things, make it the php file like 10.php if your post number is 10, paste the code inside, save it in the root of your wordpress page domain, and then your outgoing links from  that landing page will be like

Once that’s all set up properly, you should be good to get your destination urls for your ads from p202 and turn on the traffic.

Hopefully this helps someone, as it took a little while for Nickycakes to figure this out and has proven invaluable for wordpress landing pages for a number of people, but doesn’t seem to be in any p202 documentation.

Note: To track the frontpage as its own landing page, switch the is_single() to is_front_page() in the code for wordpress.

Keep it real.

Peanut Gallery

  • You should be able to put it in the post as well individually if you’re making WP show only 1 LP on the homepage at a time

  • I tried putting it in the post a few times and it never worked properly.

  • I think your correct on the post problem, doesn’t work correctly sounds like other people are having the issue to. Just linked back from the prosper202 blog!

  • Hi,

    i use proper202 for my campaigns, but instead of posts i use pages for my landingpages. I just paste the javascript at the end of my page and it works just fine.

  • I set up Prosper202 yesterday and decided not to run it. I don’t know. I still don’t trust it even if it is self hosted. It would be a trivial amount of code to send your information to another database along with your own. The Prosper202 files are encrypted so you can’t peek around under the hood to double check it. Why is free software encrypted? Why not open source it? There would be a lot more support for it. It seems a lot of effort is spent helping people set it up. That is a lot of time wasted supporting free software, time that would be better used playing the AM game and actually trying to make a little money. I’ll use it when the source is available. If it is free then why guard it like it’s a proprietary system?

    I guess I am paranoid when it comes to these things though.

  • It doesn’t work if you use “simple landing page” javascript code.

    However, if you use advanced landing page javascript code and put it in the post, it works just fine. That’s how I have it set up on all my landing pages.

    Then I just put different javascript codes in different posts.

  • @nick: I have the unencrypted version. Nothing in there to worry about.

  • Great post. :)

    Deserves some linkage.

  • @nick: I know the guys who make Prosper personally. Nothing to worry about, trust me. They’re straight A guys.

    @wes: if people start using this method, perhaps a WP plugin for P202 is in need? Could automate the steps Nicky just posted.

  • Great post, as usual :)

  • Cakes, this is a great post. I wanted to figure this out a loooong time ago and gave up. It will be great for noobs who don’t wanna pay for LP’s

    Plus i just found a premium WP theme that is perfect for a campaign i’m gonna run and the tracking was my only setback. well done

  • Great post. Posts like these are why I follow your blog. You actually provide value!

  • I believe “is_front_page()” should be changed to “is_home()”. This may depend your version of WP, though.

  • Nice hack Nick. Helpful!

    On a related note, did I get you my PPC plugin for WP? Lets you make minisites that can be more credible, without duplicating the “credibility pages” (e.g. about, contact, etc.) for every lander. If you’re not using it already, methinks you’ll like it. Hit me up and I’ll send it to you/any friends of yours. All I ask for is some feedback on any bugs you find.

  • Wish I read this earlier. I published the post hit view source copy paste to notepad. Added the javascript and put the file in my landingpage folder. Your was is much easier.

  • One more note for those of you who may have a ton of posts/pages and can’t seem to find the IDs… they were removed in 2.5. There is a plugin that will bring them back.

    Restore WordPress ID

  • I attempted to share the plugin URL to execute PHP code within posts or pages, but I received an error message on your blog here.

    If anyone wants it, ping me.

    @jessieupp (twitter)

  • great post thanks for the info.. if you were to add a lot of posts that you are tracking, do you just keep adding to the footer.php file? ie; keep adding javascript codes with diff post id’s?

  • Nice article, I use wordpress all the time for lp’s.

  • Fantastic post!

    But I also want to ask the same question as Kyle!

  • If you have more than page template or more than one post template – how will wordpress know which one to display?

    Ie if you have the below scenario:

    Post1.php with the relevant javascript
    Post2.php with the relevant javascript

    How will wordpress know which post template to pull? Post 1 or Post 2?

  • the “valid” url message is received if you don’t remove the “http://” from your url…. cats are most likely ctrl+v the url straight from prosper…


  • Was wondering how to do this exactly. Thanks Nicky! :)

  • I just use the given javascript at the end of my wp post/page & it works fine. Of course I have php-exec plugin turned on.

    Only the advanced landing page code will work with wp. So if I have only 1 offer on a single landing page, I still use advanced landing page setting but with only 1 link out.

    Prosper 202 is way better than XtremeConversions.

  • now that prosper202 is open source, we need the PHP gurus to code a WordPress plugin for P202. I’ve been able to get a “hack” working…but a full blown plugin would put a smile on my face.

  • Thanks. I just used this on my site. I added a twist, where I’m using the category as an “advanced” landing page (multiple offers).

    It’s pretty simple. I just used is_category() instead of is_single() and it works great. I also used the category slug instead of category id. That way my URL shows up as:
    and the page shows offers relevant to the key word and Quality Score rocks so far. The call is then is_category(‘key-word’).

    I’m still confused as to how I track a certain keyword all the way through from the PPC engine through the site and the completed action on the offer, but I’ll get there. Now I can at least see what’s hitting my landers.

  • Being the coding retard that I am, I couldn’t get this code to work for me on pages. So instead I did this:

    As far as I know you can enter either the page name or number and it should enter. Always check your shit before going live though.

  • I just used is_page(10) and it worked just fine. using wordpress version 2.71

  • hey thanks for this great post. only thing i don’t understand how url do i have to put as landing page in 202? if my wordpress url is

    do i post this url there? and how do i pass keyword in wordpress LP?

    thanks for help

  • Thanks,

    This should be easy, but what confuses me is there seems to be two trains of thought on here.

    One, place the code in the footer.php file or Two, place the code within the post. I see some commenters saying this works perfectly for them.

    I will mess around with this some more and see if I can get one of these methods to work for me.


  • Is there any word on a possible plug in for this? I confess to be struggling with it, though my php knowledge is rudimentary at best.

    I’m trying to figure out how you guys are even setting your WP blogs in the first place. Are you only adding a single post to your blog, so the LP is

    Or are you adding multiple posts and just using the is_single option to specify the post? In this case, I’m not sure what my landing page link should be for p202. Should it be the permalink of the post?

    Or are you creating individual pages for each post? I haven’t tinkered with this too much, but are you then using the page link for the p202 tracker?

    Thanks. Sorry, I’m very much new to this, and this has been a big headache for me. So much so that I’m considering dropping WP all together.

  • Nickcakes
    are we saying that the possibility of using prosper 202 as a good tool without having your data ripped. Is it better to install it onto your own computer for noobs to practice on. Also is there any other tracking software u recommend.

    Can you have a wordpress on your domain name with prosper202 and how to install both in the root folder.

  • There’s a new plugin available for WordPress that doesn’t involve messing with the site’s code. You can find it at

  • I couldn’t get it to work on the homepage using Nicky’s technique without getting a syntax error at the bottom of the page. I found this code posted by Wes on the prosper202 forum that works for me:

    $row ) {

    $split_chars = preg_split(‘/\?{1}/’,$navigation[$key],-1,PREG_SPLIT_OFFSET_CAPTURE);

    $navigation[$key] = $split_chars[0][0];


    if (!$navigation[1]) { ?> JAVASCRIPT CODE HERE

    and this is to be placed in your footer.php or whatever php file it is. this displays the JAVASCRIPT CODE if it is only on the HOMEPAGE.

  • Nickycakes’ code is actually a bit off which is causing it not to work properly. Here is the correct code:






  • My footer files look like they’ve been turned into some kind of encrypted code.

    Wtf is going on? I tried looking as some other template footer files and its the same bullshit.

    I dont know where the body tag will be if it looks like this:

  • Looks like this only works if you use WordPress to create separate, one-off landing PAGES, not a landing SITE. The user comes in, visits the one page, and leaves to an external offer.

    If you use WordPress as it’s originally intended – to make sites with multiple pages where people browse around before they leave – this trick still won’t help, correct? Another JS firing on another page would overwrite the first one.

  • Hey Nick,
    it would be great, if you would explain your wordpress solution in a video, because many people don`t know, how to set this up.

    Is your solution still valid to wordpress 3.0?

  • I use WordPress for all my landing pages.. I don’t know how to do all that fancy PHP stuff yet.. I will learn though..

    I use the profits theme to create my landing pages and for redirect, I use the Pretty Link lite plugin.. One thing I like about Profits Theme is it has a section at the bottom when you’re editing a page where you can paste scripts.. Makes things a lot easier.

    I have a question though…

    Do I need to link my landing page directly to the offer or create a p202 link to the offer after installing the landing page script from P202?

  • Hi Can I use Prosper 202 with the Theme?


Add a new comment