def build_custom_variable_parameters(self, params): custom_vars = self.tracker.custom_variables if custom_vars: if len(custom_vars) > 5: logger.warning( 'The sum of all custom variables cannot exceed 5 in any given request.' ) x10 = X10() x10.clear_key(self.X10_CUSTOMVAR_NAME_PROJECT_ID) x10.clear_key(self.X10_CUSTOMVAR_VALUE_PROJCT_ID) x10.clear_key(self.X10_CUSTOMVAR_SCOPE_PROJECT_ID) for cvar in custom_vars.values(): name = utils.encode_uri_components(cvar.name) value = utils.encode_uri_components(cvar.value) x10.set_key(self.X10_CUSTOMVAR_NAME_PROJECT_ID, cvar.index, name) x10.set_key(self.X10_CUSTOMVAR_VALUE_PROJCT_ID, cvar.index, value) if cvar.scope and cvar.scope != CustomVariable.SCOPE_PAGE: x10.set_key(self.X10_CUSTOMVAR_SCOPE_PROJECT_ID, cvar.index, cvar.scope) params.utme = '%s%s' % (params.utme, x10.render_url_string()) return params
def build_custom_variable_parameters(self, params): custom_vars = self.tracker.custom_variables if custom_vars: if len(custom_vars) > 5: logger.warning('The sum of all custom variables cannot exceed 5 in any given request.') x10 = X10() x10.clear_key(self.X10_CUSTOMVAR_NAME_PROJECT_ID) x10.clear_key(self.X10_CUSTOMVAR_VALUE_PROJCT_ID) x10.clear_key(self.X10_CUSTOMVAR_SCOPE_PROJECT_ID) for cvar in custom_vars.itervalues(): name = utils.encode_uri_components(cvar.name) value = utils.encode_uri_components(cvar.value) x10.set_key( self.X10_CUSTOMVAR_NAME_PROJECT_ID, cvar.index, name) x10.set_key( self.X10_CUSTOMVAR_VALUE_PROJCT_ID, cvar.index, value) if cvar.scope and cvar.scope != CustomVariable.SCOPE_PAGE: x10.set_key(self.X10_CUSTOMVAR_SCOPE_PROJECT_ID, cvar.index, cvar.scope) params.utme = '%s%s' % (params.utme, x10.render_url_string()) return params