/Sniff

Campaign Tracker on LeanCloud. WIP

Primary LanguagePythonDo What The F*ck You Want To Public LicenseWTFPL

Sniff 🐕

Sniff is a marketing campaign tracker. It shortens any given URL, and tracks who / when / where / how the link is clicked.

Features

  • Shortens the URL
  • Logs browser info
  • Logs geographic info

Requirements

Sniff runs on Python 3. It requires flask, requests and LeanCloud Python SDK.

Quick Start

Before You Begin

Sniff is a LeanCloud app. Before getting the code up and running, there're some chores to do.

  1. Create an app on LeanCloud dashboard, and set a domain name for the app.
  2. Set environment variable FLASK_SECRET_KEY in the LeanCloud dashboard. Refer to this on how to make a good solid secret key.
  3. Install LeanCloud CLI. It's not required, but is highly recommended.

Deploy Methods

Clone this repo, type lean login then lean checkout to link your local repo to the LeanCloud app you've just created.

Use virtualenv to create a virtual environment for this app. Activate the virtual environment, then use pip to install the requirements.

Use lean deploy to deploy the code onto the cloud. After that, visit the site with the domain name you set before.

In short:

$ git clone https://github.com/nervouna/Sniff.git
$ cd URL-Shortener
$ virtualenv venv --python=python3
$ source venv/bin/activate
$ pip install -r requirements.txt
$ lean login
$ lean checkout
$ lean deploy

Where's the Data?

Check out the data in the LeanCloud dashboard. All the URLs are stored in the Shortened class, and the visitor footprints are stored in the Visits class.

Note: For now you'll have to add users in LeanCloud dashboard.

Debugging

You can always use lean up to fire up a debuggable instance on your machine, and visit it via http://127.0.0.1:3000 by default.

Miscellaneous

Todos

  • QRCode for short links
  • Export data in CSV
  • Browser plugins

Maybes

  • 🤔 Full-functioning dashboard

License

License: WTFPL

Author: GUAN Xiaoyu (guanxy@me.com)