Metadata-Version: 2.1
Name: django-marketing-urls
Version: 1.0.0
Summary: An app to generate marketing urls for Django projects. 
Home-page: https://github.com/laonan/django-marketing-urls
Author: Laonan
Author-email: hello@laonan.net
Project-URL: Bug Tracker, https://github.com/laonan/django-marketing-urls/issues
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: Django>=2.0.13
Requires-Dist: urltoken>=1.0.0

# 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
