'Extract information from the request and add it to the tracking
context.
The following fields are injected into the context:
* session - The Django session key that identifies the user\'s session.
* user_id - The numeric ID for the logged in user.
* username - The username of the logged in user.
* ip - The IP address of the client.
* host - The "SERVER_NAME" header, which should be the name of the server running this code.
* agent - The client browser identification string.
* path - The path part of the requested URL.
* client_id - The unique key used by Google Analytics to identify a user'

def enter_request_context(self, request):

    context = {'session': self.get_session_key(request), 'user_id': self.get_user_primary_key(request), 'username': self.get_username(request), 'ip': self.get_request_ip_address(request)}
    for (header_name, context_key) in META_KEY_TO_CONTEXT_KEY.iteritems():
        context[context_key] = request.META.get(header_name, '').decode('latin1')
    google_analytics_cookie = request.COOKIES.get('_ga')
    if (google_analytics_cookie is None):
        context['client_id'] = request.META.get('HTTP_X_EDX_GA_CLIENT_ID')
    else:
        context['client_id'] = '.'.join(google_analytics_cookie.split('.')[2:])
    context.update(contexts.course_context_from_url(request.build_absolute_uri()))
    tracker.get_tracker().enter_context(CONTEXT_NAME, context)
