How to Turn Google Analytics Into Your Own Rank Tracker Using Custom Variables

admin » 05 October 2010 » In Uncategorized »

The How

Getting this properly set up was remarkably easy for me, and I have so very little programming knowledge, so I would imagine most wouldn’t have much issue. I used PHP, as I was working with a WordPress site, but I’m sure you crazy hackers can do the same in most any language.

Update: See Joost and André Scholten’s comments below for a JavaScript method of passing the cd= value

Step One – Extract cd= Value from Referrer String

I used this snippet to do this.

<?php preg_match("/cd\=(\d+)/",$_SERVER['HTTP_REFERER'], $matches);
$str = $matches[0];
preg_match("/(\d+)/",$str,$matches);
$rank = $matches[0] ?>

Read more

Trackback URL

Comments are closed.