Skip to main content

An app to generate marketing urls for Django projects.

Project description

Django Marketing Urls

Description

An app to generate marketing urls for Django projects. It allows you to create marketing urls with a unique token that can be used to track the source of the traffic.

Installation

pip install django-marketing-urls

in settings.py

INSTALLED_APPS = [
    ...
    'marketing_urls',
    ...
]

in urls.py

urlpatterns = [
    ...
    path('marketing/', include('marketing_urls.urls')),
    ...
]

Usage

Create a marketing url

from marketing_urls.models import MarketingUrl

MarketingUrl.objects.create(original_url='https://example.com')

Get the marketing url

    m_url = MarketingUrl.objects.get(original_url='https://example.com')
    print(m_url.marketing_url)
    
    # if you want to add extra information to the url
    from urltoken.encoder import UrlTokenEncoder
    
    token_encoder = UrlTokenEncoder('secretkey') # secretkey could be set in OS environment variable from 'URL_TOKEN_SECRET', or just leave it is None
    url_token = token_encoder.encode('my_extra_info_here')
    url_with_extra_info = m_url.marketing_url + '?t=' + url_token
    print(url_with_extra_info)

Issues

https://github.com/laonan/django-marketing-url/issues

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_marketing_urls-1.0.0.tar.gz (5.0 kB view hashes)

Uploaded Source

Built Distribution

django_marketing_urls-1.0.0-py3-none-any.whl (6.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page