Alfred App Extension for shortening links with Google analytics campaign tracking and bit.ly pro

This is a simple script I use to consistently embed Google Analytics campaign tracking code within bit.ly short urls. The approach is similar to my Klout user score look-up: it uses Alfred App Powerpack extensions (and Growl)

The GA tracking code lets us know how our overall “direct social” efforts are performing and shows with sources (Twitter, Facebook, LinkedIn) are performing best.

(I’ve stored my bitly.API_KEY and bitty.API_LOGIN in the bitly library in my python path. Get a copy of the library here.)

#!/usr/bin/python

import sys
import bitly

if len(sys.argv) < 2:
	sys.exit(2)
if len(sys.argv) == 3:
	if sys.argv[2] == 'facebook':
		short_url = bitly.shorten(sys.argv[1]+"?utm_source=facebook&utm_medium=social&utm_campaign=sm-direct")
	elif sys.argv[2] == 'linkedin':
		short_url = bitly.shorten(sys.argv[1]+"?utm_source=linkedin&utm_medium=social&utm_campaign=sm-direct")
	elif sys.argv[2] == 'twitter':
		short_url = bitly.shorten(sys.argv[1]+"?utm_source=twitter&utm_medium=social&utm_campaign=sm-direct")
else:
	short_url = bitly.shorten(sys.argv[1]+"?utm_source=twitter&utm_medium=social&utm_campaign=sm-direct")

sys.stdout.write(short_url)

Lessn More: An open-source personal URL shortening service

Lessn More: An open-source personal URL shortening service.

There’s got to be an easier way … bookmarklet sends current url to web service which launches a pop-up window like WordPress “Press This.” Service presents default options for shortening service and analytics campaign code. User selects [Twitter|Facebook|LinkedIn] chooses correct GACT code, submits. Service shortens via bit.ly api adding in google analytics tracking code and displays the shortened url selected in a form field (like v.gd). User copies via cmd-c or ctrl-c, clicks close button on pop-up window (which closed pop up window and opens new window loading [Twitter|Facebook|LinkedIn].

Small Can Be Big

Why Small Can Be Big

SmallCanBeBig.org is a new way to help based on a simple premise: give everyone a more direct, more personal, more local and more shared way to help those in need, and big things can happen.

In a single year, it costs the Commonwealth of Massachusetts $47,000 to provide shelter for one homeless family. For a fraction of that cost – around a thousand or so – donors at SmallCanBeBig.org can join together to keep a family from ever becoming homeless in the first place.

Distributed social networks, a primer

In the article, “Portable Social Networks, The Building Blocks Of A Social Web“, Ben Ward presents a nice introduction to the concepts and technology behind DSNs including microformats such as hCard and XFN. The article goes on to discuss OAuth, OpenID and has some implementation tips. This is an area that is likely to become very important in the next 12-18 months (if not sooner).

The Collaboration and Content Strategies Blog over at Burton Group has a nice piece by Mike Gotta on this article too.