Jj Del Carpio

Jj's web stream

Django external links

I made this a couple of weeks ago for a personal project. Django external links is a pluggable app that keeps track of the clicks done to external links on your site.

To install just set up an URL where should external links should be redirected to, this endpoint will keep track of the hit and redirect to the destination url

    urlpatterns += patterns(''
        url(r'^external/', include('external_links.urls')),
    )

Now you have two ways to use it, via the inline {% external %} template tag or the blog tag {% externalblock %}

The "external" tag translates a regular link into a redirected link, from <a href="{% external "http://example.com" %}">Other site</a> to <a href="/external/?link=http%3a%2f%2example.com">Other site</a>

The "externalblock" will do the same for a big block of text, it will perform the same transformation on all the anchor tags found inside, this is useful for blogposts, articles and such.

Comments

#297654" title="2009-08-03 19:59:43">Rudy: see: http://www.google.com/support/googleanalytics/bin/answer.py?answer=55527

Jj Avatar of Jj

Reply or react to this post via Webmentions