Blog

Blog

Blog

How to Track Your Craigslist, Backpage, & Other Online Ads

July 3rd | How To's

Every wonder how many hits those online ads you post are getting?

If you're positing ads online, you should know which ads are performing best, getting the most views, clicks, and ultimately leading you to the most business. In this article I'll give you an example of how to track your online ads.

What You'll Need

  1. A web hosting account with PHP and MySQL enabled
  2. A Google Analytics account
  3. Either a small 1px by 1px image or an image to use in your ads

Step 1

Create your ad using HTML or create an image to use as your ad. If you are posting plain text ads, you'll need to create a white 1px by 1px image. Upload this image to your web server.

Step 2

Create a table in your database. I called mine ad_views and have fields AV_Location, AV_Ad_Title, AV_View_Date, AV_View_Timestamp, and AV_Source.

CREATE TABLE `ad_views` (
  `AV_Location` varchar(100) NOT NULL,
  `AV_Ad_Title` varchar(100) NOT NULL,
  `AV_View_Date` date NOT NULL,
  `AV_View_Timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP,
  `AV_Source` varchar(50) NOT NULL default ''
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

AV_Location: the location the ad was posted in
AV_Ad_Title: the name of the ad for your reference
AV_View_Date: the date the ad was viewed
AV_View_Timestamp: timestamp the ad was viewed
AV_Source: craigslist, backpage, etc.

Step 3

Next, create a php script to insert ad views in to your database and display the appropriate image. Your php script will look something like this:

switch($_GET['ad_title']) {
    case 'ad1': $img .= 'ad1.jpg'; break;
    case 'ad2': $img .= 'ad2.jpg'; break;
    case 'ad3': $img .= 'ad3.jpg'; break;
}
header ('content-type: image/jpg'); 
readfile($img);

$_GET['src'] = !$_GET['src'] ? "craigslist" : $_GET['src'];
if($_GET['loc'] && $_GET['ad_title']){
    $q = "INSERT INTO ad_views(AV_Location,AV_Ad_Title,AV_View_Date,AV_Source)
    VALUES('".mysql_real_escape_string($_GET['loc'])."', 
'".mysql_real_escape_string($_GET['ad_title'])."', 
'".date('Y-m-d')."', 
'".mysql_real_escape_string($_GET['src'])."')"; 
    mysql_query($q,$con); 
}

Step 4

Now all you need to do is post your image with your online ads. The image src will point to your php script in the previous step which will add a record to the database and display the appropriate image. The HTML will look like this:

<a title="some title" 
href="http://some-page-on-your-site.com?utm_source=ad-source
&amp;utm_medium=online-ad
&amp;utm_campaign=campaign-name">
<img src="http://yourdomainname.com/your_php_script_location.php
?loc=nj&amp;ad_title=ad1&amp;src=craigslist" alt="" />
</a>

You have 3 variables to change in the image code.

loc: the location of the classifieds such as North Jersey, Central Jersey, Manhattan, etc.
ad_title: the name of your ad, this determines what image to display
src: the site the ad was posted on, Craigslist, Backpage, etc.

This image can and should be linked to a page on your website. This url has a few extra paramenters in it, utm_source, utm_medium, and utm_campaign. These parameters are used in Google Analytics to track how many people click your ads and visit your website.

I can write a whole article about these, but that's for another time. Learn more about Google's Campaign Tracking at https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingCampaigns.

Step 5

Track your ad views using Google Analytics and by querying your ad_views table. You can come up with a few queries to learn the most popular ads by name, by location, or even by the time the ads are viewed. This information can be very helpful in determining the best times, locations, and ads to post.

Need help tracking you online ads?

I can help, just give me a call at 732-925-4044 or email joe@jbrownwebsites.com or fill out the contact form.

Tags: Online Ads, Php, Mysql, Craigslist Views, Track Craigslist Ads

Like what you’ve read? Share with your friends!

Link back to us.

OR Join Our Mailing List

A valid email address is required.
Your name is required.

Post A Comment

Page generated in seconds.