معرفی شرکت ها


django-ga-measurement-protocol-0.2.0


Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر

توضیحات

A Django app to provide Google Analytics measurement protocol integration.
ویژگی مقدار
سیستم عامل -
نام فایل django-ga-measurement-protocol-0.2.0
نام django-ga-measurement-protocol
نسخه کتابخانه 0.2.0
نگهدارنده []
ایمیل نگهدارنده []
نویسنده Kevin Carrogan
ایمیل نویسنده kevin.carrogan@digital.trade.gov.uk
آدرس صفحه اصلی https://github.com/uktrade/django-ga-measurement-protocol
آدرس اینترنتی https://pypi.org/project/django-ga-measurement-protocol/
مجوز MIT
# Django Google Analytics Measurement Protocol integration ## Usage ### Installation ```bash pip install django-ga-measurement-protocol ``` ### Middleware The most basic usage is to install the page view middleware: ```python MIDDLEWARE = [ ... "django_ga_measurement_protocol.middleware.page_view_tracking_middleware", ... ] ``` and configure the required settings: ```python GA_MEASUREMENT_PROTOCOL_UA = "<tracking id>" # The tracking id for your property GA_MEASUREMENT_PROTOCOL_TRACK_EVENTS = True # By default the package won't do any tracking unless explicitly set ``` ### Additional functions There are additional functions that allow for custom tracking beyond what the the middleware provides. ```python from django_ga_measurement_protocol.track import ( track_event, track_page_view, ) def a_view(request): # Tracks an event in Google Analytics track_event( request, category="Category", # required action="Action", # required label="Label", # optional value="5", # optional ) # Tracks a page view in Google Analytics track_page_view(request) ``` The above functions will extract the basic required information from the Django request that is required to register an event/page view in Google Analytics. If more customisation is required there are additional functions that allow fully custom data to be sent to Google Analytics. ```python from django_ga_measurement_protocol.track import ( build_tracking_data, send_tracking_data, ) def a_view(request): # Builds tracking data with default information from the Django request tracking_data = build_tracking_data( request, { "additional-value": "value", }, ) # Sends tracking data to Google analytics send_tracking_data(tracking_data) ``` The values that are accepted by the measurement protocol can be found [here](https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters). ### Debug When sending data to Google Analytics, by default, nearly all data is accepted even if it is missing required data or is corrupted in some other way. However, there is a facility for Google Analytics to respond with some validation data for your events. To turn this on set the following settings: ```python GA_MEASUREMENT_PROTOCOL_DEBUG = True LOGGING = { ... 'loggers': { ... 'django_ga_measurement_protocol': { 'level': logging.DEBUG, 'handlers': ['console'], }, }, } ``` This will log the validation in the response returned from Google Analytics. This should **not** be used in production. ## Development ### Installation It is recommended to initialise a virtualenv of your choice. ```bash pip install -r requirements.txt ``` ### Formatting Formatting is done via Black and a pre-commit hook should be installed. ```bash pre-commit install ``` ### Tests To run the tests with the currently installed Python and Django version run: ```bash pytest ``` To run against all of the possible compatible Python and Django versions run: ```bash tox ```


نیازمندی

مقدار نام
>=2.2 Django
>=2 requests
~=1.2.2 scrubadub
~=3.0.7 django-ipware
- black
- pre-commit
- pytest
- pytest-django
- pytest-pythonpath
- requests-mock
- tox


زبان مورد نیاز

مقدار نام
>=3.6 Python


نحوه نصب


نصب پکیج whl django-ga-measurement-protocol-0.2.0:

    pip install django-ga-measurement-protocol-0.2.0.whl


نصب پکیج tar.gz django-ga-measurement-protocol-0.2.0:

    pip install django-ga-measurement-protocol-0.2.0.tar.gz