Home > Adwords, web design > Show different content for PPC users with PHP

Show different content for PPC users with PHP

I just recently created a new site for a client and he decided he wanted to do PPC. I created a landing page for him. I still wanted the users to be able to see the rest of the site but I wanted to show a specific phone number to PPC visitors. I created some PHP code that gives a 10 year cookie to anybody who hits my PPC landing page. On every other page in my site I put in some code that checks for that cookie and gives then a PPC phone number if they find that cookie.

Code for PPC landing page. Must be very first thing on page.

<?php
setcookie("ppc", "this works", time()+60*60*24*365*10);
?>

Code for every other page.

<?php
if (isset($_COOKIE["ppc"]))
    echo 'ppc info';
else
    echo 'non ppc info';
?>

You can use that code to display a different logo or image with phone number in it or special text. If you have your phone number all over the place I would put your phone numbers in different include files so that you can change them easily.

Code for include

<?php
if (isset($_COOKIE["ppc"]))
    include 'ppc-phone.inc';
else
    include 'phone.inc';
?>

Technorati Tags: , , ,
Categories: Adwords, web design Tags:
  1. No comments yet.
  1. No trackbacks yet.