{ "info": { "author": "Richard Latimer, Sarah Ellis", "author_email": "rlatimer@indeed.com, sellis@indeed.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", "Framework :: Django", "Framework :: Django :: 1.10", "Framework :: Django :: 1.11", "Framework :: Django :: 1.8", "Framework :: Django :: 1.9", "Framework :: Django :: 2.0", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6" ], "description": "# Django Ptrack\nPtrack is a tracking pixel library for Django.\n\nYou can use Ptrack to detect email open rates or to create your own pixel tracking API.\nWhen used by Indeed, Ptrack generates pixels with average request to response lifecycles of <80 ms.\n\nEach tracking pixel is a unique encoded image generated per arg/kwargs set.\nUnlike other tracking pixel libraries, Ptrack is stateless and does not require a database.\nInstead, ptrack allows developers to pass in metadata which is encrypted and stored in the image url.\n\n## Getting Started\nInstall the library using Pip:\n```\npip install django-ptrack\n```\n\n### Configuration\n1. Add Ptrack to your installed apps in settings:\n```\nINSTALLED_APPS = (\n ...,\n 'ptrack',\n ...\n)\n```\n\n2. Define a secret that is 32-character bytes or fewer.\nThe secret is used to create an encrypted tracking pixel url.\n```\nPTRACK_SECRET = \"\"\n```\n\n3. Define a Ptrack app URL in your settings. This is the domain that the tracking pixel will be based on.\n```\nPTRACK_APP_URL = \"\" # Example: PTRACK_APP_URL = \"https://www.example.com\"\n```\n\n*NOTE:* The PTRACK_APP_URL gives you a lot of flexibility.\nFor example, if you are trying to track emails from a web app hosted on an internal network, you can deploy a public facing mirror web app that records the pixels.\nAs long as the internal and external apps share the same secret and are registered on the same URL path prefix, tracking should work.\n\n\n\n## Using Ptrack\nLoad and define Ptrack in templates:\n```\n{% load ptrack %}\n{% ptrack 'arg' key1='arg1' key2='arg2' ... %}\n```\n\nWhen the ptrack template tag is expanded, it generates a tracking pixel of form:\n```\n\n```\n\n*NOTE:*\n* Keep in mind that valid arg and kwarg values must be json serializable ints or strings.\nIf non-valid inputs are provided, the template tag will throw an exception. \n* When testing a tracking pixel in an email locally or with a domain that is not publicly accessible, the tracking pixel in the email will appear as an empty box rather than as an invisible pixel.\nThe reason the image is rendered as an error image is because most email servers, such as Gmail, will proxy img tags.\n* If the server has downtime, the pixel appears as an empty box.\nFor this reason, it is best to include the tracking pixel at the bottom of an email or page. \n* Realize that the encoded metadata tied to the tracking pixel is stored in the URL.\nAs a best practice, the number of characters you store should be less than half the maximum character limit of your supported browser. \n\n\n### Define tracking functionality\nPtrack automatically searches your project for a file called `pixels.py`, in which you register your pixel tracking callbacks.\n\nCreate this file in your project.\nDefine the tracking functionality by overriding base class, defining the record() method, and registering the new class:\n```\nimport ptrack\nclass CustomTrackingPixel(ptrack.TrackingPixel):\n def record(self, request, *args, **kwargs):\n log.info(request.META['HTTP_USER_AGENT'])\n for arg in args:\n log.info(arg)\n for key, value in kwargs:\n if key == \"testemail1\":\n log.info(\"Recorded test email\")\n else:\n log.info(key + \":\" + value)\n\nptrack.tracker.register(CustomTrackingPixel)\n```\n\nWhenever your tracking pixel is loaded, the record() callback method is executed. \n\n### Define multiple callbacks\nYou can register multiple definitions of `ptrack.TrackingPixel` to chain callbacks, although there is no guarantee of the order they will execute. \n\n*NOTE:* The tracking response will not complete until all the record() methods have finished executing, so you shouldn't run any long running blocking processes.\n\n### Register ptrack.urls\nIn `url.py`, register 'ptrack.urls' on your desired url prefix pattern:\n```\nurl('^ptrack/', include('ptrack.urls')),\n```\n\n## Validation requirements\nPtrack ignores anything it cannot decrypt or deserialize.\nCallbacks are not run if someone attempts to guess a URL endpoint.\n\n\n## Testing\nTo build tests, navigate to the ptrack directory on your local machine and run\n```\npython setup.py test\n```\n\n## Overriding the encoder\nWhile ptrack should work out of the box, you have the ability to create your own encoder. \n\nSuppose you created a class MyEncoder, with _static_ `encrypt` and `decrypt` methods.\nIn your application's `pixels.py`, you then register the encoder:\n```\nimport ptrack\nptrack.ptrack_encoder = MyEncoder\n```\n\n## Installation Errors\nIf you run into installation errors, such as:\n```\ndistutils.errors.DistutilsError: Setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1\n```\n\nYou may need to install system dependencies for PyNacl:\n```\nsudo apt-get install python-dev\nsudo apt-get install libffi-dev\n```\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/indeedeng/django-ptrack", "keywords": "django", "license": "Apache", "maintainer": "", "maintainer_email": "", "name": "django-ptrack", "package_url": "https://pypi.org/project/django-ptrack/", "platform": "", "project_url": "https://pypi.org/project/django-ptrack/", "project_urls": { "Homepage": "https://github.com/indeedeng/django-ptrack" }, "release_url": "https://pypi.org/project/django-ptrack/2.1.0/", "requires_dist": [ "Django (>=1.8.1)", "pynacl (>=1.0.1)", "pycrypto (>=2.6.1) ; extra == 'legacy'" ], "requires_python": "", "summary": "Ptrack is a tracking pixel library for Django", "version": "2.1.0" }, "last_serial": 5067358, "releases": { "1.1.0": [ { "comment_text": "", "digests": { "md5": "3973e3cb5f40360ef23a4b427b0b17d8", "sha256": "8a8e3d0a297e90b2c5e457030bd7f7c7a47f95fc7029bfd4cd4d43eee2c05249" }, "downloads": -1, "filename": "django_ptrack-1.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "3973e3cb5f40360ef23a4b427b0b17d8", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 14184, "upload_time": "2017-08-07T16:32:29", "url": "https://files.pythonhosted.org/packages/73/c8/298d927139b7ef3dd3ae9883d10bb3b07e6d4cfc4a17b7894cddfb2f8836/django_ptrack-1.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "de199871c2fda0e2f3b8d3734da0ba5b", "sha256": "86cf344a0d75c5654aee231af9fe00d7eb8392dc5eacc72992e69558edf64945" }, "downloads": -1, "filename": "django-ptrack-1.1.0.tar.gz", "has_sig": false, "md5_digest": "de199871c2fda0e2f3b8d3734da0ba5b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8003, "upload_time": "2017-08-07T16:32:31", "url": "https://files.pythonhosted.org/packages/5f/2f/adb4f5113487e0b33cf5a0e2c78b30f3288040726fae39f27e7a62bdd42f/django-ptrack-1.1.0.tar.gz" } ], "1.2.0": [ { "comment_text": "", "digests": { "md5": "782fd918446391ed9e408f5d2d832a1b", "sha256": "c7b15afd0893641c9d116d7249064a862f002fb52a2c91c57f7b3d408c1a538d" }, "downloads": -1, "filename": "django_ptrack-1.2.0-py2-none-any.whl", "has_sig": false, "md5_digest": "782fd918446391ed9e408f5d2d832a1b", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 14020, "upload_time": "2018-03-07T22:05:29", "url": "https://files.pythonhosted.org/packages/c1/66/4051b2c0f2ede54330db70ac5cb53207b78c82902fb74659ea18130770fa/django_ptrack-1.2.0-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d7b26ba05528c6ebf41685235e663e2d", "sha256": "ee323827dc2aaa6c6dbce2c97987018c54b261e73ff94c07c661e44633e11dfa" }, "downloads": -1, "filename": "django_ptrack-1.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "d7b26ba05528c6ebf41685235e663e2d", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 14024, "upload_time": "2018-03-07T22:05:31", "url": "https://files.pythonhosted.org/packages/6b/3d/4796e10ab79b2fb40649aff31b1a4fc1de06eef21512f589866de97a2aca/django_ptrack-1.2.0-py2.py3-none-any.whl" } ], "2.0.0": [ { "comment_text": "", "digests": { "md5": "41dade0aba2db004b968155c47a758a4", "sha256": "9b75b7fdd43bbda7820993367dadc1ef10f10c1c713fda0797b926d006f110ca" }, "downloads": -1, "filename": "django_ptrack-2.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "41dade0aba2db004b968155c47a758a4", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 14892, "upload_time": "2019-03-28T18:04:21", "url": "https://files.pythonhosted.org/packages/b4/28/23fbe6a33c94f21c9c62436bd7d3be482504f6002fe0e0fe6967878aef41/django_ptrack-2.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e4a29acc4e5fb2bda015e9251999b658", "sha256": "c813c03086330c1f87884aa723c86b8f6ecedf9d1c0f97130d635e563ca17584" }, "downloads": -1, "filename": "django-ptrack-2.0.0.tar.gz", "has_sig": false, "md5_digest": "e4a29acc4e5fb2bda015e9251999b658", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8493, "upload_time": "2019-03-28T18:04:23", "url": "https://files.pythonhosted.org/packages/d3/17/6b809068d09e4ffec8218ec29d8d47bd9d573f9ed00e553d7b02a352a3a8/django-ptrack-2.0.0.tar.gz" } ], "2.1.0": [ { "comment_text": "", "digests": { "md5": "d5dffd5ac631f61037fe52f9bfb78c8e", "sha256": "b78ccfb9fe8ef0f44640c1530115d1260917ad11db48cdd339ef7c000ce3fde0" }, "downloads": -1, "filename": "django_ptrack-2.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "d5dffd5ac631f61037fe52f9bfb78c8e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 14947, "upload_time": "2019-04-02T17:15:12", "url": "https://files.pythonhosted.org/packages/e9/9c/e717b4d23c1c686e33e094e402bef82255b2336851536e2110f8db225e26/django_ptrack-2.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c64f14250d1a9db47e1c9a8fcb303e55", "sha256": "d8f0cb9e23504c2bef5c32b0b2b1b5fe105d47d847aed20bafd9dd894fb53707" }, "downloads": -1, "filename": "django-ptrack-2.1.0.tar.gz", "has_sig": false, "md5_digest": "c64f14250d1a9db47e1c9a8fcb303e55", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8530, "upload_time": "2019-04-02T17:15:13", "url": "https://files.pythonhosted.org/packages/dd/cf/71a317861b106168f26c1e95d655ed3200524aac549356c97e97ede4da1d/django-ptrack-2.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d5dffd5ac631f61037fe52f9bfb78c8e", "sha256": "b78ccfb9fe8ef0f44640c1530115d1260917ad11db48cdd339ef7c000ce3fde0" }, "downloads": -1, "filename": "django_ptrack-2.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "d5dffd5ac631f61037fe52f9bfb78c8e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 14947, "upload_time": "2019-04-02T17:15:12", "url": "https://files.pythonhosted.org/packages/e9/9c/e717b4d23c1c686e33e094e402bef82255b2336851536e2110f8db225e26/django_ptrack-2.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c64f14250d1a9db47e1c9a8fcb303e55", "sha256": "d8f0cb9e23504c2bef5c32b0b2b1b5fe105d47d847aed20bafd9dd894fb53707" }, "downloads": -1, "filename": "django-ptrack-2.1.0.tar.gz", "has_sig": false, "md5_digest": "c64f14250d1a9db47e1c9a8fcb303e55", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8530, "upload_time": "2019-04-02T17:15:13", "url": "https://files.pythonhosted.org/packages/dd/cf/71a317861b106168f26c1e95d655ed3200524aac549356c97e97ede4da1d/django-ptrack-2.1.0.tar.gz" } ] }