示例#1
0
def tags_added(tag_links):
    event_name = 'app_tag_added'
    for tag_link in tag_links:
        log_to_mixpanel(distinct_id=tag_link.content_object.get_uuid(),
                        event_name=event_name,
                        tag_name=tag_link.tag.name,
                        **mixpanel_applicant_data(
                            tag_link.content_object.applicant),
                        **mixpanel_user_data(tag_link.user))
示例#2
0
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)
示例#3
0
def tags_added(tag_links):
    event_name = 'app_tag_added'
    for tag_link in tag_links:
        log_to_mixpanel(
            distinct_id=tag_link.content_object.get_uuid(),
            event_name=event_name,
            tag_name=tag_link.tag.name,
            **mixpanel_applicant_data(tag_link.content_object.applicant),
            **mixpanel_user_data(tag_link.user))
示例#4
0
def user_app_transferred(old_application, new_application, user):
    event_name = 'user_app_transferred'
    log_to_mixpanel(distinct_id=user.profile.get_uuid(),
                    event_name=event_name,
                    applicant_uuid=old_application.form_submission.get_uuid(),
                    from_org=old_application.organization.name,
                    to_org=new_application.organization.name,
                    **mixpanel_applicant_data(
                        old_application.form_submission.applicant),
                    **mixpanel_user_data(user))
示例#5
0
def user_app_transferred(old_application, new_application, user):
    event_name = 'user_app_transferred'
    log_to_mixpanel(
        distinct_id=user.profile.get_uuid(),
        event_name=event_name,
        applicant_uuid=old_application.form_submission.get_uuid(),
        from_org=old_application.organization.name,
        to_org=new_application.organization.name,
        **mixpanel_applicant_data(old_application.form_submission.applicant),
        **mixpanel_user_data(user))
示例#6
0
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)
示例#7
0
def app_transferred(old_application, new_application, user):
    event_name = 'app_transferred'
    log_to_mixpanel(distinct_id=old_application.form_submission.get_uuid(),
                    event_name=event_name,
                    user_email=user.email,
                    from_application_id=old_application.id,
                    to_application_id=new_application.id,
                    from_organization_name=old_application.organization.name,
                    to_organization_name=new_application.organization.name,
                    **mixpanel_applicant_data(
                        old_application.form_submission.applicant),
                    **mixpanel_user_data(user))
示例#8
0
def app_transferred(old_application, new_application, user):
    event_name = 'app_transferred'
    log_to_mixpanel(
        distinct_id=old_application.form_submission.get_uuid(),
        event_name=event_name,
        user_email=user.email,
        from_application_id=old_application.id,
        to_application_id=new_application.id,
        from_organization_name=old_application.organization.name,
        to_organization_name=new_application.organization.name,
        **mixpanel_applicant_data(old_application.form_submission.applicant),
        **mixpanel_user_data(user))
示例#9
0
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
示例#10
0
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