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
- Create a .env including this parameter COM_GOOGLE_ANALYTICS_TRACKING_ID
export COM_GOOGLE_ANALYTICS_TRACKING_ID=G-XXXXXXXXXX
- Install python-dotenv
pip install python-dotenv
- load the .env in your entry point (app.py, main.py, test.py)
from dotenv import load_dotenv
load_dotenv()
- 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 :
-
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
- install :
dependencies
- See requirements.txt
Build this package
-
build the setup.py
python3 setup.py sdist bdist_wheel
python3 -m pip install --user --upgrade twine --use-feature=2020-resolver
-
upload the library on TEST pypi.org
python -m twine upload --repository-url https://test.pypi.org/legacy/ dist/*
- Source : https://test.pypi.org/project/altf1be_helpers
-
upload the library on PROD pypi.org
python -m twine upload dist/*
- Source : https://pypi.org/project/altf1be_helpers
Documentation to build a Python package
- Packaging Python Projects https://packaging.python.org/tutorials/packaging-projects/
- Managing Application Dependencies https://packaging.python.org/tutorials/managing-dependencies/#managing-dependencies
- Packaging and distributing projects https://packaging.python.org/guides/distributing-packages-using-setuptools/#distributing-packages
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
Release history Release notifications | RSS feed
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
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | ebbe6a3b1f0e25a1ade9fd3b6633268c4028a6d4bb611d368e9a17e2a0c473fb |
|
MD5 | 55df233bfbd18f53c20c864341462927 |
|
BLAKE2b-256 | 16ab17fa7189a13d0ffae6f7ab84f5237978ef0064d06889bce4fbb36af37095 |
File details
Details for the file altf1be_google_analytics_helpers-1.0.0-py2.py3-none-any.whl
.
File metadata
- Download URL: altf1be_google_analytics_helpers-1.0.0-py2.py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 2, Python 3
- 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 87d867fc750d854d1b75bba1f3d882344769ac7dd07172d53dce037feaf19434 |
|
MD5 | 3d99a14d106695abc7fdd5a2f5c9a852 |
|
BLAKE2b-256 | 4eae7f990794616ca989c06fa6cd984595d3dd1ab55aabcf809953e11de1f70c |