Ejemplo n.º 1
0
 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")
Ejemplo n.º 2
0
 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")
Ejemplo n.º 3
0
 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 ")
Ejemplo n.º 4
0
    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")
Ejemplo n.º 5
0
    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")
Ejemplo n.º 6
0
 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
Ejemplo n.º 7
0
 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")
Ejemplo n.º 8
0
 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")
Ejemplo n.º 9
0
 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)
Ejemplo n.º 11
0
 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")
Ejemplo n.º 12
0
    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)
Ejemplo n.º 14
0
 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")
Ejemplo n.º 15
0
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
Ejemplo n.º 16
0
 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")
Ejemplo n.º 17
0
 def __init__(self):
     self.site_id = get_required_setting('CLICKY_SITE_ID', SITE_ID_RE,
             "must be a (string containing) a number")
Ejemplo n.º 18
0
 def __init__(self):
     self.default_widget_key = get_required_setting(
         'USERVOICE_WIDGET_KEY', WIDGET_KEY_RE,
         "must be an alphanumeric string")
Ejemplo n.º 19
0
 def __init__(self):
     self.portal_id = get_required_setting('HUBSPOT_PORTAL_ID', PORTAL_ID_RE,
                                           "must be a (string containing a) number")
Ejemplo n.º 20
0
 def __init__(self):
     self.user_id = get_required_setting('CHARTBEAT_USER_ID', USER_ID_RE,
             "must be (a string containing) a number")
Ejemplo n.º 21
0
 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")
Ejemplo n.º 22
0
 def __init__(self):
     self.tracking_id = get_required_setting('REINVIGORATE_TRACKING_ID',
             TRACKING_ID_RE,
             "must be a string looking like XXXXX-XXXXXXXXXX")
Ejemplo n.º 23
0
 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")
Ejemplo n.º 24
0
 def __init__(self):
     self.counter_id = get_required_setting(
             'YANDEX_METRICA_COUNTER_ID', COUNTER_ID_RE,
             "must be (a string containing) a number'")
Ejemplo n.º 25
0
 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'")
Ejemplo n.º 26
0
 def __init__(self):
     self.api_key = get_required_setting('PERFORMABLE_API_KEY', API_KEY_RE,
             "must be a string looking like 'XXXXX'")
Ejemplo n.º 27
0
 def __init__(self):
     self.account_nr = get_required_setting('CRAZY_EGG_ACCOUNT_NUMBER',
             ACCOUNT_NUMBER_RE, "must be (a string containing) a number")
Ejemplo n.º 28
0
 def __init__(self):
     self.tracker_id = get_required_setting('CLICKMAP_TRACKER_ID',
                                            CLICKMAP_TRACKER_ID_RE,
                                            "must be an alphanumeric string")
Ejemplo n.º 29
0
 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')''')
Ejemplo n.º 30
0
 def __init__(self):
     self.user_id = get_required_setting(
         'CHARTBEAT_USER_ID', USER_ID_RE,
         "must be (a string containing) a number")
Ejemplo n.º 31
0
 def __init__(self):
     self.tracker_id = get_required_setting(
         'CLICKMAP_TRACKER_ID', CLICKMAP_TRACKER_ID_RE,
         "must be a (string containing) a number")
Ejemplo n.º 32
0
 def __init__(self):
     self.domain = get_required_setting('WOOPRA_DOMAIN', DOMAIN_RE,
                                        "must be a domain name")
Ejemplo n.º 33
0
 def __init__(self):
     self.domain = get_required_setting('WOOPRA_DOMAIN', DOMAIN_RE,
             "must be a domain name")
Ejemplo n.º 34
0
 def __init__(self):
     self.app_id = get_required_setting(
             'INTERCOM_APP_ID', APP_ID_RE,
             "must be a string looking like 'XXXXXXX'")
Ejemplo n.º 35
0
 def __init__(self):
     self.tracking_id = get_required_setting('SPRING_METRICS_TRACKING_ID',
         TRACKING_ID_RE, "must be a hexadecimal string")
Ejemplo n.º 36
0
 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")
Ejemplo n.º 37
0
 def __init__(self):
     self.counter_id = get_required_setting(
         'RATING_MAILRU_COUNTER_ID', COUNTER_ID_RE,
         "must be (a string containing) a number'")
Ejemplo n.º 38
0
 def __init__(self):
     self.counter_id = get_required_setting(
             'RATING_MAILRU_COUNTER_ID', COUNTER_ID_RE,
             "must be (a string containing) a number'")
Ejemplo n.º 39
0
 def __init__(self):
     self.portal_id = get_required_setting(
         'HUBSPOT_PORTAL_ID', PORTAL_ID_RE,
         "must be a (string containing a) number")
Ejemplo n.º 40
0
 def __init__(self):
     self.site_id = get_required_setting(
         'GAUGES_SITE_ID', SITE_ID_RE,
         "must be a string looking like 'XXXXXXX'")
Ejemplo n.º 41
0
 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'")
Ejemplo n.º 42
0
 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'")
Ejemplo n.º 43
0
 def __init__(self):
     self.default_widget_key = get_required_setting(
         "USERVOICE_WIDGET_KEY", WIDGET_KEY_RE, "must be an alphanumeric string"
     )
Ejemplo n.º 44
0
 def __init__(self):
     self.app_id = get_required_setting(
             'INTERCOM_APP_ID', APP_ID_RE,
             "must be a string looking like 'XXXXXXX'")
Ejemplo n.º 45
0
 def __init__(self):
     self.tracker_id = get_required_setting('CLICKMAP_TRACKER_ID',
             CLICKMAP_TRACKER_ID_RE,
             "must be a (string containing) a number")
Ejemplo n.º 46
0
 def __init__(self):
     self.tracking_id = get_required_setting(
         'SPRING_METRICS_TRACKING_ID', TRACKING_ID_RE,
         "must be a hexadecimal string")
Ejemplo n.º 47
0
 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")
Ejemplo n.º 48
0
 def __init__(self):
     self.tracking_id = get_required_setting(
         'REINVIGORATE_TRACKING_ID', TRACKING_ID_RE,
         "must be a string looking like XXXXX-XXXXXXXXXX")
Ejemplo n.º 49
0
 def __init__(self):
     self.pixel_id = get_required_setting(
         'FACEBOOK_PIXEL_ID',
         re.compile(r'^\d+$'),
         "must be (a string containing) a number",
     )
Ejemplo n.º 50
0
 def __init__(self):
     self.site_id = get_required_setting(
         'CLICKY_SITE_ID', SITE_ID_RE,
         "must be a (string containing) a number")
Ejemplo n.º 51
0
 def __init__(self):
     self.counter_id = get_required_setting(
         'YANDEX_METRICA_COUNTER_ID', COUNTER_ID_RE,
         "must be (a string containing) a number'")
Ejemplo n.º 52
0
 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'")
Ejemplo n.º 53
0
 def __init__(self):
     self.account_nr = get_required_setting(
         'CRAZY_EGG_ACCOUNT_NUMBER', ACCOUNT_NUMBER_RE,
         "must be (a string containing) a number")
Ejemplo n.º 54
0
 def __init__(self):
     self.pixel_id = get_required_setting(
         'FACEBOOK_PIXEL_ID',
         re.compile(r'^\d+$'),
         "must be (a string containing) a number",
     )
Ejemplo n.º 55
0
 def __init__(self):
     self.site_token = get_required_setting(
             'GOSQUARED_SITE_TOKEN', TOKEN_RE,
             "must be a string looking like XXX-XXXXXX-X")
Ejemplo n.º 56
0
 def __init__(self):
     self.site_id = get_required_setting(
         'HOTJAR_SITE_ID',
         re.compile(r'^\d+$'),
         "must be (a string containing) a number",
     )
Ejemplo n.º 57
0
 def __init__(self):
     self.tracker_id = get_required_setting(
         'CLICKMAP_TRACKER_ID', CLICKMAP_TRACKER_ID_RE,
         "must be an alphanumeric string")