Add the hostname to mixpanel requests.

This commit is contained in:
Jake Moshenko 2015-12-16 13:43:31 -05:00
parent f228a0b13a
commit d5bebe2149

View file

@ -1,6 +1,8 @@
import logging
import random
from urlparse import urlparse
from app import analytics, app, userevents
from data import model
from flask import request
@ -53,9 +55,11 @@ def track_and_log(event_name, repo, analytics_name=None, analytics_sample=1, **k
metadata['public'] = True
analytics_id = 'anonymous'
request_parsed = urlparse(request.url_root)
extra_params = {
'repository': '%s/%s' % (namespace, repository),
'user-agent': request.user_agent.string,
'hostname': request_parsed.hostname,
}
# Publish the user event (if applicable)