def user_page_viewed(request, response): event_name = 'user_page_viewed' data = dict(distinct_id=request.visitor.get_uuid(), event_name=event_name, **mixpanel_request_data(request), **mixpanel_user_data(request.user)) if response.view: data.update(mixpanel_view_data(response.view)) log_to_mixpanel(**data)
def page_viewed(request, response): event_name = 'page_viewed' data = dict(distinct_id=request.visitor.get_uuid(), event_name=event_name, http_status_code=response.status_code, **mixpanel_request_data(request)) if response.view: data.update(mixpanel_view_data(response.view)) log_to_mixpanel(**data)
def page_viewed(request, response): event_name = 'page_viewed' data = dict( distinct_id=request.visitor.get_uuid(), event_name=event_name, http_status_code=response.status_code, **mixpanel_request_data(request)) if response.view: data.update(mixpanel_view_data(response.view)) log_to_mixpanel(**data)
def user_page_viewed(request, response): event_name = 'user_page_viewed' data = dict( distinct_id=request.visitor.get_uuid(), event_name=event_name, **mixpanel_request_data(request), **mixpanel_user_data(request.user)) if response.view: data.update(mixpanel_view_data(response.view)) log_to_mixpanel(**data)
def mixpanel_data_from_view_request_user(view, request=None, user=None): """Extracts basic data from a view, request, and user for mixpanel. If request and user are not explicitly passed, this function will attempt to extract both from the view. """ data = mixpanel_view_data(view) request = request or getattr(view, 'request', None) user = user or getattr(request, 'user', None) if request: data.update(mixpanel_request_data(view.request)) if user and getattr(user, 'is_authenticated', False): data.update(mixpanel_user_data(user)) return data
def site_entered(visitor, request): event_name = 'site_entered' log_to_mixpanel(distinct_id=visitor.get_uuid(), event_name=event_name, **mixpanel_request_data(request))
def site_entered(visitor, request): event_name = 'site_entered' log_to_mixpanel( distinct_id=visitor.get_uuid(), event_name=event_name, **mixpanel_request_data(request))