If you’re using Google Analytics and you’re not taking advantage of its built-in campaign tracking, you’re missing out on important insights. Campaign tracking uses URL query strings to determine where your traffic is coming from specifically. URL query strings are the funny “?something=this&somethingelse=that” text that you see on the end of URLs (try a Google search and look in your address bar). By using this tracking method, you can understand your traffic better and learn what’s working and what isn’t. It’s particularly beneficial for people who are promoting their site across several different channels like email, Twitter, and Google Adwords. Here is a little more in-depth description from Google.
The most annoying part about using tracking codes, however, is creating the URL. You need to append at least two (and up to five) query strings to your URL to use this function in Analytics and making this happen while tracking what codes you’re actually using is frustrating enough to make you rethink this whole thing in the first place. Google provides a cute little tool to help you but it’s still a pain in the ass.
Google Docs to the rescue! Using similar code as my simple Google Docs CMS, I created a script that parses a spreadsheet full of tracking codes and turn them into usable URLs that you can then copy and paste. It makes it easy to keep track of the campaigns you have while quickly creating error-free URLs. See the Google Docs UTM appender in action.
Download the UTM URL builder (updated 8/31/2010)
What you’ll need:
Easy enough… go to docs.google.com and log in. Click the Create New button on the top left and select “Spreadsheet.”


The config.txt file that this package comes with points to the URL of the feed that creates the sample page above. Simple open config.txt and paste the URL you got in Step 1 in between the quotes (replacing what’s there).
rss feed “[paste your feed here]“
If the link is correct, the script should be ready to display the Google Doc. Unless you have a server instance installed locally, you’ll need to upload this script to a public web server. If you have your own website, just upload this file to any public folder. If you’re confused, email your IT department or your tech-savvy niece/nephew.
Once the file is uploaded, you’ll want to test it out to make sure everything is working. Go to the file you uploaded (http://[your domain]/[the path to the folder you used]/link-append-util.php) and you should see “UTM coded URLs” at the top. If you see “Invalid feed!” then the link to the Google Doc was not made. Make sure the URL is correct and in between the tick marks after $feedName=.
Once the script is functioning, you’re ready to input your URLs and tracking codes.
The spreadsheet needs to by laid out properly to make sure that the script can read and display the information in the right order. Here are the rules and you can see a sample of a functioning Google Doc here (it’s the one I use to create the example here).
A few things to keep in mind:
Once your codes are loaded, refresh the script and you’ll see them listed nicely in a row. In order for each one:
That’s all I ask!
Please leave comments, questions, and suggestions below. I hope this saves you as much time as it save me!
Will you follow me on Twitter? You can also subscribe to my posts via RSS here or via email here.
This looks great, however it does not seem to be working with the current version of Google Spreadsheets. Any updates?
Thanks,
Jeff Hall
On August 27th, 2010 at 2:51 pm , Josh said...Good call Jeff… I found this problem with the Drudge Report template but forgot I had this posted as well. I’ll make the change and add it here, nothing too in-depth.
Thanks for the reminder!
On August 31st, 2010 at 10:28 am , Josh said...Updated and working with the current Google Docs version! Please comment here if you have any questions or problems.