def __init__(self): self.account_number = get_required_setting( 'KISS_INSIGHTS_ACCOUNT_NUMBER', ACCOUNT_NUMBER_RE, "must be (a string containing) a number") self.site_code = get_required_setting( 'KISS_INSIGHTS_SITE_CODE', SITE_CODE_RE, "must be a string containing three characters")
def __init__(self): self.property_id = get_required_setting( 'GOOGLE_ANALYTICS_PROPERTY_ID', PROPERTY_ID_RE, "must be a string looking like 'UA-XXXXXX-Y'") self.tracked_domain_name = get_required_setting( 'GOOGLE_ANALYTICS_TRACKED_DOMAIN', TRACKED_DOMAIN_RE, "must be a string ")
def test_get_required_setting(self): """ Make sure using get_required_setting fails in the right place. """ with self.assertRaisesRegex(AnalyticalException, "^USER_ID setting is not set$"): get_required_setting("USER_ID", r"\d+", "invalid USER_ID")
def test_get_required_setting(self): """ Make sure using get_required_setting fails in the right place. """ with pytest.raises(AnalyticalException, match="USER_ID setting is not set"): get_required_setting("USER_ID", r"\d+", "invalid USER_ID")
def __init__(self): self.tracker_id = get_required_setting('CLICKTALE_PROJECT_ID', CLICKTALE_PROJECT_ID_RE, "must be a (string containing) a number") self.recording_ratio = get_required_setting('CLICKTALE_RECORDING_RATIO', CLICKTALE_PROJECT_ID_RE, "must be a (string containing) a number") self
def __init__(self): self.domain_path = get_required_setting( "PIWIK_DOMAIN_PATH", DOMAINPATH_RE, "must be a domain name, optionally followed " "by an URI path, no trailing slash (e.g. " "piwik.example.com or my.piwik.server/path)", ) self.site_id = get_required_setting("PIWIK_SITE_ID", SITEID_RE, "must be a (string containing a) number")
def __init__(self): self.domain_path = \ get_required_setting('MATOMO_DOMAIN_PATH', DOMAINPATH_RE, "must be a domain name, optionally followed " "by an URI path, no trailing slash (e.g. " "matomo.example.com or my.matomo.server/path)") self.site_id = \ get_required_setting('MATOMO_SITE_ID', SITEID_RE, "must be a (string containing a) number")
def __init__(self): self.domain_path = \ get_required_setting('PIWIK_DOMAIN_PATH', DOMAINPATH_RE, "must be a domain name, optionally followed " "by an URI path, no trailing slash (e.g. " "piwik.example.com or my.piwik.server/path)") self.site_id = \ get_required_setting('PIWIK_SITE_ID', SITEID_RE, "must be a (string containing a) number")
def __init__(self): self.property_id = get_required_setting( 'GOOGLE_ANALYTICS_GTAG_PROPERTY_ID', PROPERTY_ID_RE, '''must be a string looking like one of these patterns ('UA-XXXXXX-Y' , 'AW-XXXXXXXXXX', 'G-XXXXXXXX', 'DC-XXXXXXXX')''') self.identity_function = getattr(settings, 'IDENTITY_FUNCTION', None)
def test_get_required_setting(self): """ Make sure using get_required_setting fails in the right place. """ with self.assertRaises(AnalyticalException) as e: user_id = get_required_setting("USER_ID", "\d+", "invalid USER_ID") self.assertEqual(e.exception.message, "USER_ID setting: not found")
def test_get_required_setting(self): """ Make sure using get_required_setting fails in the right place. """ # available in python >= 3.2 if hasattr(self, 'assertRaisesRegex'): with self.assertRaisesRegex(AnalyticalException, "^USER_ID setting is not set$"): get_required_setting("USER_ID", r"\d+", "invalid USER_ID") # available in python >= 2.7, deprecated in 3.2 elif hasattr(self, 'assertRaisesRegexp'): with self.assertRaisesRegexp(AnalyticalException, "^USER_ID setting is not set$"): get_required_setting("USER_ID", r"\d+", "invalid USER_ID") else: self.assertRaises(AnalyticalException, get_required_setting, "USER_ID", r"\d+", "invalid USER_ID")
def __init__(self, is_required): if is_required: self.property_id = get_required_setting( 'GOOGLE_ANALYTICS_JS_PROPERTY_ID', PROPERTY_ID_RE, "must be a string looking like 'UA-XXXXXX-Y'") else: # all good, just see if it's defined but don't complain if not self.property_id = getattr(settings, 'GOOGLE_ANALYTICS_JS_PROPERTY_ID', None)
def test_get_required_setting(self): """ Make sure using get_required_setting fails in the right place. """ # only available in python >= 2.7 if hasattr(self, 'assertRaisesRegexp'): with self.assertRaisesRegexp(AnalyticalException, "^USER_ID setting: not found$"): user_id = get_required_setting("USER_ID", "\d+", "invalid USER_ID") else: self.assertRaises(AnalyticalException, get_required_setting, "USER_ID", "\d+", "invalid USER_ID")
def piwik_search(context, query, category=False, count=False): """ Piwik search tracking template tag. Renders Javascript code to track internal page searches. See piwik tag. It takes 3 parameters: - Search string (required) - Search category (optional) - Result count (optional) """ domain_path = \ get_required_setting('PIWIK_DOMAIN_PATH', DOMAINPATH_RE, "must be a domain name, optionally followed " "by an URI path, no trailing slash (e.g. " "piwik.example.com or my.piwik.server/path)") site_id = \ get_required_setting('PIWIK_SITE_ID', SITEID_RE, "must be a (string containing a) number") pretrack = _get_additional_calls(context) html = TRACKING_CODE % { 'method': "['trackSiteSearch', %s, %s, %s]" % ( json.dumps(query), json.dumps(category), json.dumps(count), ), 'url': domain_path, 'siteid': site_id, 'pretrack': pretrack, } if is_internal_ip(context, 'PIWIK'): html = disable_html(html, 'Piwik') return html
def __init__(self): self.api_key = get_required_setting( 'KISS_METRICS_API_KEY', API_KEY_RE, "must be a string containing a 40-digit hexadecimal number")
def __init__(self): self.site_id = get_required_setting('CLICKY_SITE_ID', SITE_ID_RE, "must be a (string containing) a number")
def __init__(self): self.default_widget_key = get_required_setting( 'USERVOICE_WIDGET_KEY', WIDGET_KEY_RE, "must be an alphanumeric string")
def __init__(self): self.portal_id = get_required_setting('HUBSPOT_PORTAL_ID', PORTAL_ID_RE, "must be a (string containing a) number")
def __init__(self): self.user_id = get_required_setting('CHARTBEAT_USER_ID', USER_ID_RE, "must be (a string containing) a number")
def __init__(self): self.portal_id = get_required_setting('HUBSPOT_PORTAL_ID', PORTAL_ID_RE, "must be a (string containing a) number") self.domain = get_required_setting('HUBSPOT_DOMAIN', DOMAIN_RE, "must be an internet domain name")
def __init__(self): self.tracking_id = get_required_setting('REINVIGORATE_TRACKING_ID', TRACKING_ID_RE, "must be a string looking like XXXXX-XXXXXXXXXX")
def __init__(self): self.api_key = get_required_setting('KISS_METRICS_API_KEY', API_KEY_RE, "must be a string containing a 40-digit hexadecimal number")
def __init__(self): self.counter_id = get_required_setting( 'YANDEX_METRICA_COUNTER_ID', COUNTER_ID_RE, "must be (a string containing) a number'")
def __init__(self): self.widget_id = get_required_setting( 'SNAPENGAGE_WIDGET_ID', WIDGET_ID_RE, "must be a string looking like this: 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'")
def __init__(self): self.api_key = get_required_setting('PERFORMABLE_API_KEY', API_KEY_RE, "must be a string looking like 'XXXXX'")
def __init__(self): self.account_nr = get_required_setting('CRAZY_EGG_ACCOUNT_NUMBER', ACCOUNT_NUMBER_RE, "must be (a string containing) a number")
def __init__(self): self.tracker_id = get_required_setting('CLICKMAP_TRACKER_ID', CLICKMAP_TRACKER_ID_RE, "must be an alphanumeric string")
def __init__(self): self.property_id = get_required_setting( 'GOOGLE_ANALYTICS_GTAG_PROPERTY_ID', PROPERTY_ID_RE, '''must be a string looking like one of these patterns ('UA-XXXXXX-Y' , 'AW-XXXXXXXXXX', 'G-XXXXXXXX', 'DC-XXXXXXXX')''')
def __init__(self): self.user_id = get_required_setting( 'CHARTBEAT_USER_ID', USER_ID_RE, "must be (a string containing) a number")
def __init__(self): self.tracker_id = get_required_setting( 'CLICKMAP_TRACKER_ID', CLICKMAP_TRACKER_ID_RE, "must be a (string containing) a number")
def __init__(self): self.domain = get_required_setting('WOOPRA_DOMAIN', DOMAIN_RE, "must be a domain name")
def __init__(self): self.app_id = get_required_setting( 'INTERCOM_APP_ID', APP_ID_RE, "must be a string looking like 'XXXXXXX'")
def __init__(self): self.tracking_id = get_required_setting('SPRING_METRICS_TRACKING_ID', TRACKING_ID_RE, "must be a hexadecimal string")
def __init__(self): self.token = get_required_setting( 'MIXPANEL_API_TOKEN', MIXPANEL_API_TOKEN_RE, "must be a string containing a 32-digit hexadecimal number")
def __init__(self): self.counter_id = get_required_setting( 'RATING_MAILRU_COUNTER_ID', COUNTER_ID_RE, "must be (a string containing) a number'")
def __init__(self): self.portal_id = get_required_setting( 'HUBSPOT_PORTAL_ID', PORTAL_ID_RE, "must be a (string containing a) number")
def __init__(self): self.site_id = get_required_setting( 'GAUGES_SITE_ID', SITE_ID_RE, "must be a string looking like 'XXXXXXX'")
def __init__(self): self.property_id = get_required_setting( 'GOOGLE_ANALYTICS_PROPERTY_ID', PROPERTY_ID_RE, "must be a string looking like 'UA-XXXXXX-Y'")
def __init__(self): self.site_id = get_required_setting('OLARK_SITE_ID', SITE_ID_RE, "must be a string looking like 'XXXX-XXX-XX-XXXX'")
def __init__(self): self.default_widget_key = get_required_setting( "USERVOICE_WIDGET_KEY", WIDGET_KEY_RE, "must be an alphanumeric string" )
def __init__(self): self.tracker_id = get_required_setting('CLICKMAP_TRACKER_ID', CLICKMAP_TRACKER_ID_RE, "must be a (string containing) a number")
def __init__(self): self.tracking_id = get_required_setting( 'SPRING_METRICS_TRACKING_ID', TRACKING_ID_RE, "must be a hexadecimal string")
def __init__(self): self.tracking_id = get_required_setting( 'REINVIGORATE_TRACKING_ID', TRACKING_ID_RE, "must be a string looking like XXXXX-XXXXXXXXXX")
def __init__(self): self.pixel_id = get_required_setting( 'FACEBOOK_PIXEL_ID', re.compile(r'^\d+$'), "must be (a string containing) a number", )
def __init__(self): self.site_id = get_required_setting( 'CLICKY_SITE_ID', SITE_ID_RE, "must be a (string containing) a number")
def __init__(self): self.account_nr = get_required_setting( 'CRAZY_EGG_ACCOUNT_NUMBER', ACCOUNT_NUMBER_RE, "must be (a string containing) a number")
def __init__(self): self.site_token = get_required_setting( 'GOSQUARED_SITE_TOKEN', TOKEN_RE, "must be a string looking like XXX-XXXXXX-X")
def __init__(self): self.site_id = get_required_setting( 'HOTJAR_SITE_ID', re.compile(r'^\d+$'), "must be (a string containing) a number", )
def __init__(self): self.tracker_id = get_required_setting( 'CLICKMAP_TRACKER_ID', CLICKMAP_TRACKER_ID_RE, "must be an alphanumeric string")