{{ searchResult.published_at | date:'d MMMM yyyy' }}

Loading ...
Loading ...

Enter a search term such as “mobile analytics” or browse our content using the filters above.

No_results

That’s not only a poor Scrabble score but we also couldn’t find any results matching “”.
Check your spelling or try broadening your search.

Logo_distressed

Sorry about this, there is a problem with our search at the moment.
Please try again later.

Earlier this week E-consultancy's own Drama 2.0 discussed current click fraud rates with PPC ad programs.

As an active user of PPC marketing, I wanted to chime in with my strategy for dealing with the issue.

There are a lot of companies that offer services designed to help online advertisers detect and defeat click fraud but if you have some basic skills with PHP and MySQL (or other languages/databases), you may not need them.

A few years ago, I developed my own little application that I use to keep track of my clicks and I'd like to share some of the basic components with you.

The Database

Create a MySQL table using the following:

CREATE TABLE `click_log` (
  `click_id` int(10) unsigned NOT NULL auto_increment,
  `group_id` int(10) unsigned NOT NULL,
  `timestamp` int(10) unsigned NOT NULL,
  `date` int(10) unsigned NOT NULL,
  `ip` varchar(25) NOT NULL,
  `user_agent` varchar(200) NOT NULL,
  `referer` varchar(300) NOT NULL,
  PRIMARY KEY  (`click_id`)
) ENGINE=MyISAM AUTO_INCREMENT=17 DEFAULT CHARSET=utf8 AUTO_INCREMENT=17 ;

This table stores the following important pieces of data:

The ad group from which the click came, the time of the click, the IP address of the clicker, the user agent of the clicker's browser and the website that referred the click (if any).

The Script

When setting up your campaigns, you will want to use a script that tracks the click and then redirects the user to the proper page.

I've cut out of my application the core code that deals with the tracking:

<?php

 require_once("includes/functions.inc.php");

 $conn = @db_connect();
 $gid = trim(htmlentities(strip_tags($_GET['gid'])));
 
 $timestamp = time();
 $date = date("Ymd", $timestamp);
 $referer = $_SERVER['HTTP_REFERER'];
 $ip = $_SERVER['REMOTE_ADDR'];
 $user_agent = $_SERVER['HTTP_USER_AGENT'];
 $log = @mysql_query("INSERT INTO click_log (group_id, timestamp, date, ip, referer, user_agent) VALUES ('$gid', '$timestamp', '$date', '$ip', '$referer', '$user_agent')");
 
 //Add logic for redirecting the user based on the group ID - $gid

 header("Location: $url");

?>

Note: db_connect is a common function included in functions.inc.php that connects to the MySQL database

The script is very straightforward. It inserts all of the data we've collected about the click into the database and redirects the user to the desired page based on the group ID associated with the ad campaign.

What's Next?

Once you're collecting this data, there's really no limit to what you can do with it. The front-end that I built allows me to analyze the data and provides visual representations of the clicks my campaigns have received. It also lets me manage my campaigns.

If you're collecting data and closely monitoring your campaigns, you will notice patterns and when you see something out of the ordinary (increasing number of clicks from a specific campaign, lots clicks coming from a specific geographic region, etc.), you can take appropriate action to try to determine if this is likely to be fraudulent and most importantly, can take action to make modifications to your campaigns if it is.

If you want to take things even further, you can expand your application to compare click data to the data provided by the PPC services you use (like AdSense). You can also integrate with web analytics software to gain insight into which clicks might be fraudulent by tracking what a "user" does on your website after the click.

One important thing to note is the fact that some of the data we're collecting, such as referer, can be forged. But this does not mean that our methodology is flawed.

Remember - eliminating click fraud altogether is impossible. The goal is to catch click fraud patterns early on so that your losses aren't greater than they need to be.

Avatar-blank-50x50

Published 12 November, 2008 by Patrick Oak

82 more posts from this author

Comments (3)

Avatar-blank-50x50

Vince

Hi, thanks for this. I assume your code is only useful to publishers, not advertisers?

I only dabble with code, so would appreciate any further instructions or examples regarding the //Add logic for redirecting the user part

thanks

about 8 years ago

Avatar-blank-50x50

Chris P.

I don't bother with PPC models anymore. They simplly drain too much money from my budget. Recently moved my retail affilation over to Sortprice.com, which uses a flat fee monthly system rather than PPC and I recommend people explore that option as well:

http://www.sortprice.com/

about 8 years ago

Avatar-blank-50x50

Patrick Oak, Blogger at Econsultancy

Vince,

The code can be used by anyone. If you have a server that supports PHP/MySQL, you can set this up and redirect users to sites that are run by clients, partners, affiliate program operators, etc.

Here's some sample logic:

if ($gid == 1)
$url = "http://www.e-consultancy.com&quot;;
if ($gid == 2)
$url = "http://www.emailbuild.com&quot;;

This redirects the user to E-consultancy's website if the "gid" variable in the query string is set to 1 and to your website if the "gid" variable in the query string is set to 2.

Once again, you can implement a lot more depending on your needs. Here are some suggestions:

- Add a database table that contains the group IDs (gids) and their associated URLs so that you can add more easily without having to hard code for each gid.

- Add an extra variable - campaign ID - so that you can track things more granularly.

Hope this helps.

about 8 years ago

Comment
No-profile-pic
Save or Cancel
Daily_pulse_signup_wide

Enjoying this article?

Get more just like this, delivered to your inbox.

Keep up to date with the latest analysis, inspiration and learning from the Econsultancy blog with our free Daily Pulse newsletter. Each weekday, you ll receive a hand-picked digest of the latest and greatest articles, as well as snippets of new market data, best practice guides and trends research.