import random import time import settings def get_google_analytics_tracking(request): """Gets a chunk of HTML which will track Google Analytics using the current version of the JavaScript, alongside a noscript version.""" web_property_id = getattr(settings, 'GOOGLE_ANALYTICS_ID', False) domain = getattr(settings, 'GOOGLE_ANALYTICS_DOMAIN', False) if not web_property_id or not domain: return ('