{ "info": { "author": "Steadman", "author_email": "mark@steadman.io", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Framework :: Django" ], "description": "Bambu Analytics\n===============\n\nProvides a simple, pluggable system for analytics\n\nAbout Bambu Analytics\n---------------------\n\nBambu Analytics provides a simple system for implementing analytics\ntools like Google Analytics into your Django projects, so you can track\npage views, goals and events.\n\nBy default it supports Google's `Universal\nAnalytics `_\nprogramme, but you interact with the package within JavaScript via the\n``bambu.analytics`` namespace. This way, you can change analytics\nproviders (or write your own) without changing the code within the rest\nof your site.\n\nThis is massively a work-in-progress.\n\nAbout Bambu Tools 2.0\n---------------------\n\nThis is part of a toolset called Bambu Tools. It's being moved from a\nnamespace of ``bambu`` to its own 'root-level' package, along with all\nthe other tools in the set. If you're upgrading from a version prior to\n2.0, please make sure to update your code to use ``bambu_analytics``\nrather than ``bambu.analytics``.\n\nInstallation\n------------\n\nInstall the package via Pip:\n\n::\n\n pip install bambu-analytics\n\nAdd it to your ``INSTALLED_APPS`` list:\n\n::\n\n INSTALLED_APPS = (\n ...\n 'bambu_analytics'\n )\n\nNext, install the tracking middleware:\n\n::\n\n MIDDLEWARE_CLASSES = (\n ...\n 'bambu_analytics.middleware.AnalyticsMiddleware',\n ...\n )\n\nFinally, set your Google Analytics ID:\n\n::\n\n ANALYTICS_SETTINGS = {\n 'UniversalAnalyticsProvider': {\n 'ID': 'UA-XXXXXXXX-XX'\n }\n }\n\nOr, use the shortcut setting:\n\n::\n\n GOOGLE_ANALYTICS_IDS = ('UA-XXXXXXXX-XX',)\n\n(This is a legacy setting that will be deprecated in a future release)\n\nUsage\n-----\n\nBy default, all page views will be tracked once you include the\n``tracking`` template tag in your base HTML template, like so:\n\n::\n\n \n \n ...\n \n ...\n {% load analytics %}{% tracking %}\n \n \n\nTracking events are gathered by the middleware, as it allows trackable\nevents to be defined server-side. For example, when you submit an\nenquiry form, you can add an event that will be tracked once the user is\nredirected to the 'thank you' page.\n\nThe workflow\n------------\n\n1. The user requests a URL\n2. The analytics middleware adds a page-view event to its tracking list\n3. The view for that URL is rendered, and the script containing the\n analytics setup code and the tracked event from step 2 is rendered\n4. The user submits a form on the page\n5. The view for that form calls ``bambu_analytics.track_event``\n6. An HTTP redirect is issued\n7. The middleware reads the redirect and stores the tracking event in a\n session variable\n8. The user's browser is redirected to a 'thank you' page\n9. When the 'thank you' page is rendered, the tracking event stored in\n the session variable are read into JavaScript and rendered\n\nAll of this sounds complex, but actually means you can track events more\neasily and in a pluggable, product-agnostic way. It also provides the\noption for server-side analytics events to be tracked.\n\nIn Google Analytics, the practical upshot is that it uses events rather\nthan goals, meaning you don't have to manually define them in your\nAnalytics property.\n\nTracking an event\n-----------------\n\nLet's say you have a contact form. In the view that receives the form\ndata, you want to track the successful submission of form data and then\nredirect the user to a page thanking them for getting in touch.\n\n::\n\n from bambu_analytics import track_event, events\n\n def enquiry_form(request):\n # Handle submission of form data\n\n track_event(request, events.EVENT,\n category = u'Enquiry',\n action = u'Submit'\n )\n\nHere, ``events.EVENT`` is a constant meaning 'a standard event'.\n\nIf you're using a client-side analytics library (like Google Analytics),\nyou should only track events in this way if you're going to redirect the\nuser back to a page that will load and render the ``tracking`` template\ntag. Otherwise the event will be stored in the user's session cookie,\nbut won't be tracked by your provider.\n\nIf you're using a server-side provider - or you've written one, a:\nplease let me know! but b: - this method should work fine.\n\nTrackable events\n----------------\n\nThere are four types of trackable event within Bambu Analytics, but not\nall of them are setup to work with Google's Universal Analytics just\nyet.\n\n- ``events.PAGE``: a page view (this is handled automatically by\n middleware)\n- ``events.EVENT``: something of note happening on the site, that you\n want to measure\n- ``events.TRANSACTION``: a monetary transaction\n- ``events.TRANSACTION_ITEM``: part of an order (an item in someone's\n shopping cart)\n\nThe last two haven't been properly hooked up to Google's new system, but\nyou can use the legacy provider (see below).\n\nChanging analytics provider\n---------------------------\n\nBambu Analytics supports the legacy (ua.js) and new (analytics.js)\nscripts as provided by Google. ecommerce is setup to work with the old\nstyle (ua.js), so if you need to track ecommerce events, you should\nchange the provider via your Django settings file:\n\n::\n\n ANALYTICS_PROVIDER = 'bambu_analytics.providers.google.GoogleAnalyticsProvider'\n\nWriting your own provider\n-------------------------\n\nIt's pretty easy to write your own provider. Start by taking a look at\nthe two classes in ``bambu_analytics.providers.google`` to see how\nthey're hooked up.\n\nEssentially the job of a provider is to take Python objects that refer\nto events and turn them into JavaScript objects and function calls that\nyour analytics library can understand.\n\nEach provider needs to render a string. For client-side analytics tools\nthis should contain HTML with a ``\n\nTodo\n----\n\n- Implement ecommerce into the Universal Analytics provider\n\nQuestions or suggestions?\n-------------------------\n\nFind me on Twitter (@iamsteadman) or `visit my blog `_.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/iamsteadman/bambu-analytics", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "bambu-analytics", "package_url": "https://pypi.org/project/bambu-analytics/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/bambu-analytics/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/iamsteadman/bambu-analytics" }, "release_url": "https://pypi.org/project/bambu-analytics/2.0.1/", "requires_dist": null, "requires_python": null, "summary": "Provides a simple, pluggable system for analytics in Django", "version": "2.0.1" }, "last_serial": 1140613, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "3def7bfbba2225d3f2a0e4cbfcf90416", "sha256": "b95b049055086976f1375ffa3023934e0ce6aeadffb32eb54d783d5cd4ee7188" }, "downloads": -1, "filename": "bambu-analytics-0.1.tar.gz", "has_sig": false, "md5_digest": "3def7bfbba2225d3f2a0e4cbfcf90416", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3595, "upload_time": "2014-01-28T16:21:38", "url": "https://files.pythonhosted.org/packages/c9/b8/389412ba1626978f01265e1f1528b532ed4aa504f530cc7071f068fd15c5/bambu-analytics-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "96395ac3b9f1baa0e55f8ba1b9f8ba6a", "sha256": "f25a147e644280ae70193bd7120900fff7fc980b03638106b113dc37266c8cf5" }, "downloads": -1, "filename": "bambu-analytics-0.2.tar.gz", "has_sig": false, "md5_digest": "96395ac3b9f1baa0e55f8ba1b9f8ba6a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5074, "upload_time": "2014-04-21T13:06:32", "url": "https://files.pythonhosted.org/packages/5b/3e/5f90457638d571215aa0e234c33a158b93b9929d4bd6942956dcaf0c9db7/bambu-analytics-0.2.tar.gz" } ], "2.0": [ { "comment_text": "", "digests": { "md5": "4b0af316c45051b475823051e8aa4369", "sha256": "8e6e8d1127e831bbac8770670739ffbadc0156b4fc52de6841efb4a167ec0f72" }, "downloads": -1, "filename": "bambu-analytics-2.0.tar.gz", "has_sig": false, "md5_digest": "4b0af316c45051b475823051e8aa4369", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10107, "upload_time": "2014-05-03T16:39:30", "url": "https://files.pythonhosted.org/packages/f5/4d/55f5c97b235092819d45a708a4978e44f3e2c442b27a67ab125265f459cd/bambu-analytics-2.0.tar.gz" } ], "2.0.1": [ { "comment_text": "", "digests": { "md5": "515c2215245a457d627b005fd0485bca", "sha256": "2999aff3ed64bc481b5ec236e0e090c14e9eb91273aac62711212604927a59d9" }, "downloads": -1, "filename": "bambu-analytics-2.0.1.tar.gz", "has_sig": false, "md5_digest": "515c2215245a457d627b005fd0485bca", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10099, "upload_time": "2014-06-28T10:21:27", "url": "https://files.pythonhosted.org/packages/5f/ce/7c7cfb832c42ec8b31a94b5ed3d3261f4559b957149f41d0fc42ddfd36c6/bambu-analytics-2.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "515c2215245a457d627b005fd0485bca", "sha256": "2999aff3ed64bc481b5ec236e0e090c14e9eb91273aac62711212604927a59d9" }, "downloads": -1, "filename": "bambu-analytics-2.0.1.tar.gz", "has_sig": false, "md5_digest": "515c2215245a457d627b005fd0485bca", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10099, "upload_time": "2014-06-28T10:21:27", "url": "https://files.pythonhosted.org/packages/5f/ce/7c7cfb832c42ec8b31a94b5ed3d3261f4559b957149f41d0fc42ddfd36c6/bambu-analytics-2.0.1.tar.gz" } ] }