Captures clicks on external links, and invokes a callback (signal).
Useful for tracking outbound links.
- python >= 2.7
- django >= 1.8
pip install django-external-urls
Add 'external_urls' to INSTALLED_APPS
INSTALLED_APPS += ( 'external_urls', )
Add external_urls to root urls
urlpatterns = [ url(r'', include('external_urls.urls')), ]
The templates can be used as follows:
{% load external_urls %} {% external_url object.website %} {% external_url "http://example.com/" %}
Sends a Signal,
external_link
:from external_links.signals import external_click from django.dispatch import receiver @receiver(external_click) def my_callback(sender, url, ip): print("tracked click to {} from {}".format(url, ip))