Esempio n. 1
0
    def build_parameters(self):
        params = Parameters()
        params.utmac = self.tracker.account_id
        params.utmhn = self.tracker.domain_name
        params.utmt = self.get_type()
        params.utmn = utils.get_32bit_random_num()
        '''
        The "utmip" parameter is only relevant if a mobile analytics ID
        (MO-XXXXXX-X) was given
        '''
        params.utmip = self.visitor.ip_address
        params.aip = self.tracker.config.anonimize_ip_address and 1 or None

        # Add override User-Agent parameter (&ua) and override IP address
        # parameter (&uip). Note that the override IP address parameter is
        # always anonymized, as if &aip were present (see
        # https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#uip)
        params.ua = self.visitor.user_agent
        params.uip = utils.anonymize_ip(self.visitor.ip_address)

        if params.aip:
            # If anonimization of ip enabled? then!
            params.utmip = utils.anonymize_ip(params.utmip)

        params.utmhid = self.session.session_id
        params.utms = self.session.track_count
        params = self.build_visitor_parameters(params)
        params = self.build_custom_variable_parameters(params)
        params = self.build_campaign_parameters(params)
        params = self.build_cookie_parameters(params)
        return params
Esempio n. 2
0
    def build_parameters(self):
        params = Parameters()
        params.utmac = self.tracker.account_id
        params.utmhn = self.tracker.domain_name
        params.utmt = self.get_type()
        params.utmn = utils.get_32bit_random_num()
        '''
        The "utmip" parameter is only relevant if a mobile analytics ID
        (MO-XXXXXX-X) was given
        '''
        params.utmip = self.visitor.ip_address
        params.aip = self.tracker.config.anonimize_ip_address and 1 or None
        if params.aip:
            # If anonimization of ip enabled? then!
            params.utmip = utils.anonymize_ip(params.utmip)

        params.utmhid = self.session.session_id
        params.utms = self.session.track_count
        params = self.build_visitor_parameters(params)
        params = self.build_custom_variable_parameters(params)
        params = self.build_campaign_parameters(params)
        params = self.build_cookie_parameters(params)
        return params
    def build_parameters(self):
        params = Parameters()
        params.utmac = self.tracker.account_id
        params.utmhn = self.tracker.domain_name
        params.utmt = self.get_type()
        params.utmn = utils.get_32bit_random_num()
        '''
        The "utmip" parameter is only relevant if a mobile analytics ID
        (MO-XXXXXX-X) was given
        '''
        params.utmip = self.visitor.ip_address
        params.aip = self.tracker.config.anonimize_ip_address and 1 or None
        if params.aip:
            # If anonimization of ip enabled? then!
            params.utmip = utils.anonymize_ip(params.utmip)

        params.utmhid = self.session.session_id
        params.utms = self.session.track_count
        params = self.build_visitor_parameters(params)
        params = self.build_custom_variable_parameters(params)
        params = self.build_campaign_parameters(params)
        params = self.build_cookie_parameters(params)
        return params
Esempio n. 4
0
 def generate_unique_id(self):
     '''Generates a unique user ID from the current user-specific properties.'''
     return ((utils.get_32bit_random_num() ^ self.generate_hash())
             & 0x7fffffff)
Esempio n. 5
0
 def generate_session_id():
     return utils.get_32bit_random_num()
Esempio n. 6
0
 def __init__(self):
     self.session_id = utils.get_32bit_random_num()
     self.track_count = 0
     self.start_time = datetime.utcnow()
Esempio n. 7
0
 def generate_unique_id(self):
     '''Generates a unique user ID from the current user-specific properties.'''
     return ((utils.get_32bit_random_num() ^ self.generate_hash()) & 0x7fffffff)
Esempio n. 8
0
 def generate_session_id():
     return utils.get_32bit_random_num()
Esempio n. 9
0
 def __init__(self):
     self.session_id = utils.get_32bit_random_num()
     self.track_count = 0
     self.start_time = datetime.utcnow()