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.1.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_marketing_urls-1.0.1-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file django_marketing_urls-1.0.1.tar.gz.

File metadata

  • Download URL: django_marketing_urls-1.0.1.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.0

File hashes

Hashes for django_marketing_urls-1.0.1.tar.gz
Algorithm Hash digest
SHA256 7d9d4918d9f44696d9e296210019ba6de643b717de32dd06ec4f0a3768b709f3
MD5 410f9b92339788503998f079e3ac4fc7
BLAKE2b-256 6e3bcdab93cdd39aa1a4e65b2bf7cc0f5f5ba298939b8839d6e0868128c51ccd

See more details on using hashes here.

File details

Details for the file django_marketing_urls-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for django_marketing_urls-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a4c0f8d6fae83c5dcf6f688444a385e2a45ed42ce78dc0e85ede7bbc4041614e
MD5 0418ffa54880dc582d43ef11c44195dd
BLAKE2b-256 797a4ef27746c9778d448cc28c20292b60de930300a11a02cdfdda0c1ff3216d

See more details on using hashes here.

Supported by

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