Source

django-ga-tracking / ga_tracking / context_processors.py

1
2
3
4
5
6
7
8
9
from . import settings

def ga_tracking_id(request):
    is_super = request.user.is_authenticated() and request.user.is_superuser
    return dict(
        GA_TRACKING_ID=settings.GA_TRACKING_ID,
        GA_DOMAIN=settings.GA_DOMAIN,
        GA_USER_TRACKABLE=settings.GA_TRACK_SUPERUSER and is_super
    )