Fix for GA unique_id being regenerated each time.

pull/684/head
Louis Vézina 5 years ago
parent 8008c5f019
commit cf36e8f3b6

@ -29,6 +29,8 @@ def track_event(category=None, action=None, label=None):
try:
if settings.analytics.visitor:
visitor = pickle.loads(base64.b64decode(settings.analytics.visitor))
if visitor.user_agent is None:
visitor.user_agent = os.environ.get("SZ_USER_AGENT")
if visitor.unique_id > int(0x7fffffff):
visitor.unique_id = random.randint(0, 0x7fffffff)
except:

Loading…
Cancel
Save