title: Django external links
link: http://jj.isgeek.net/2009/07/django-external-links/
author: Jj
description: 
post_id: 550
date: 2009/07/04 19:10:29
created_gmt: 2009/07/05 00:10:29
comment_status: open
slug: django-external-links

I made this a couple of weeks ago for a personal project. [Django external links](http://github.com/jjdelc/django-external-links/tree/master) 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

**[Rudy](#297654 "2009-08-03 19:59:43"):** see: http://www.google.com/support/googleanalytics/bin/answer.py?answer=55527

