Skip to main content

Google Analytics helpers facilitating the setting of the categories, actions, labels, User Id and User Agents built by www.alt-f1.be

Project description

altf1be_google_analytics_helpers

Helpers for Google Analytics facilitating the setting of the categories, actions, labels, User Id and User Agents.

See https://bitbucket.org/altf1be/altf1be_google_analytics_helpers

Google Analytics: https://analytics.google.com

Author: Abdelkrim BOUJRAF, http://www.alt-f1.be

Usage

  1. Create a .env including this parameter COM_GOOGLE_ANALYTICS_TRACKING_ID
export COM_GOOGLE_ANALYTICS_TRACKING_ID=G-XXXXXXXXXX
  1. Install python-dotenv
pip install python-dotenv
  1. load the .env in your entry point (app.py, main.py, test.py)
from dotenv import load_dotenv

load_dotenv()
  1. Run the code and check if the event is set on Google Analytics
from altf1be_google_analytics_helpers import GoogleAnalytics
import requests

googleAnalytics = GoogleAnalytics()

USER_ID: int, 0 if you DO NOT store a user_id 

googleAnalytics.track_event(
    category="set a category",
    action="set an action",
    label="set a label",
    value=0, # Event value, must be an integer. i.e. the value of a basket
    ua=request.headers.get("User-Agent"),
)

installation

  • install the package on pypi.org :

    • install : pip install altf1be_google_analytics_helpers
    • upgrade : pip install altf1be_google_analytics_helpers --upgrade
  • install the package on test.pypi.org :

    • install : pip install -i https://test.pypi.org/simple/altf1be_google_analytics_helpers
    • upgrade : pip install -i https://test.pypi.org/simple/altf1be_google_analytics_helpers --upgrade

dependencies

Build this package

Documentation to build a Python package

License

Copyright (c) ALT-F1 SPRL, Abdelkrim BOUJRAF. All rights reserved.

Licensed under the EUPL License, Version 1.2.

See LICENSE in the project root for license information.

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

Built Distribution

altf1be_google_analytics_helpers-1.0.0-py2.py3-none-any.whl (9.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file altf1be_google_analytics_helpers-1.0.0.tar.gz.

File metadata

  • Download URL: altf1be_google_analytics_helpers-1.0.0.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1

File hashes

Hashes for altf1be_google_analytics_helpers-1.0.0.tar.gz
Algorithm Hash digest
SHA256 ebbe6a3b1f0e25a1ade9fd3b6633268c4028a6d4bb611d368e9a17e2a0c473fb
MD5 55df233bfbd18f53c20c864341462927
BLAKE2b-256 16ab17fa7189a13d0ffae6f7ab84f5237978ef0064d06889bce4fbb36af37095

See more details on using hashes here.

File details

Details for the file altf1be_google_analytics_helpers-1.0.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for altf1be_google_analytics_helpers-1.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 87d867fc750d854d1b75bba1f3d882344769ac7dd07172d53dce037feaf19434
MD5 3d99a14d106695abc7fdd5a2f5c9a852
BLAKE2b-256 4eae7f990794616ca989c06fa6cd984595d3dd1ab55aabcf809953e11de1f70c

See more details on using hashes here.

Supported by

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