def _get_domain_fields(self, context):
     domain_fields = {}
     tracking_type = getattr(settings, 'GOOGLE_ANALYTICS_TRACKING_STYLE', TRACK_SINGLE_DOMAIN)
     if tracking_type == TRACK_SINGLE_DOMAIN:
         pass
     else:
         domain = get_domain(context, 'google_analytics')
         if domain is None:
             raise AnalyticalException(
                 "tracking multiple domains with Google Analytics requires a domain name")
         domain_fields['legacyCookieDomain'] = domain
         if tracking_type == TRACK_MULTIPLE_DOMAINS:
             domain_fields['allowLinker'] = True
     return domain_fields
 def _get_domain_commands(self, context):
     commands = []
     tracking_type = getattr(settings, 'GOOGLE_ANALYTICS_TRACKING_STYLE',
                             TRACK_SINGLE_DOMAIN)
     commands.append(self._get_create_command(context, tracking_type))
     if tracking_type != TRACK_SINGLE_DOMAIN:
         commands.append(REQUIRE_LINKER_CODE)
         domain = get_domain(context, 'google_analytics')
         if domain is None:
             raise AnalyticalException(
                 "tracking multiple domains with Google Analytics requires a domain name"
             )
         commands.append(DOMAIN_CODE % domain)
     return commands
 def _get_domain_fields(self, context):
     domain_fields = {}
     tracking_type = getattr(settings, 'GOOGLE_ANALYTICS_TRACKING_STYLE', TRACK_SINGLE_DOMAIN)
     if tracking_type == TRACK_SINGLE_DOMAIN:
         pass
     else:
         domain = get_domain(context, 'google_analytics')
         if domain is None:
             raise AnalyticalException(
                 "tracking multiple domains with Google Analytics requires a domain name")
         domain_fields['legacyCookieDomain'] = domain
         if tracking_type == TRACK_MULTIPLE_DOMAINS:
             domain_fields['allowLinker'] = True
     return domain_fields
Ejemplo n.º 4
0
 def _get_domain_commands(self, context):
     commands = []
     tracking_type = getattr(settings, 'GOOGLE_ANALYTICS_TRACKING_STYLE',
             TRACK_SINGLE_DOMAIN)
     if tracking_type == TRACK_SINGLE_DOMAIN:
         pass
     else:
         domain = get_domain(context, 'google_analytics')
         if domain is None:
             raise AnalyticalException("tracking multiple domains with"
                     " Google Analytics requires a domain name")
         commands.append(DOMAIN_CODE % domain)
         commands.append(NO_ALLOW_HASH_CODE)
         if tracking_type == TRACK_MULTIPLE_DOMAINS:
             commands.append(ALLOW_LINKER_CODE)
     return commands
Ejemplo n.º 5
0
 def _get_domain_commands(self, context):
     commands = []
     tracking_type = getattr(settings, 'GOOGLE_ANALYTICS_TRACKING_STYLE',
             TRACK_SINGLE_DOMAIN)
     if tracking_type == TRACK_SINGLE_DOMAIN:
         pass
     else:
         domain = get_domain(context, 'google_analytics')
         if domain is None:
             raise AnalyticalException("tracking multiple domains with"
                     " Google Analytics requires a domain name")
         commands.append(DOMAIN_CODE % domain)
         commands.append(NO_ALLOW_HASH_CODE)
         if tracking_type == TRACK_MULTIPLE_DOMAINS:
             commands.append(ALLOW_LINKER_CODE)
     return commands
Ejemplo n.º 6
0
 def test_get_analytical_domain_from_settings(self):
     context = Context()
     self.assertEqual(get_domain(context, 'test'), 'example.org')
Ejemplo n.º 7
0
 def test_get_service_domain_from_settings(self):
     context = Context()
     self.assertEqual(get_domain(context, 'test'), 'example.net')
Ejemplo n.º 8
0
 def test_get_analytical_domain_from_context(self):
     context = Context({'analytical_domain': 'example.com'})
     self.assertEqual(get_domain(context, 'test'), 'example.com')
Ejemplo n.º 9
0
 def test_get_service_domain_from_context(self):
     context = Context({'test_domain': 'example.com'})
     self.assertEqual(get_domain(context, 'test'), 'example.com')
Ejemplo n.º 10
0
 def test_get_analytical_domain_from_context(self):
     context = Context({'analytical_domain': 'example.com'})
     assert get_domain(context, 'test') == 'example.com'
Ejemplo n.º 11
0
 def test_get_analytical_domain_from_settings(self):
     context = Context()
     self.assertEqual(get_domain(context, 'test'), 'example.org')
Ejemplo n.º 12
0
 def test_get_service_domain_from_settings(self):
     context = Context()
     self.assertEqual(get_domain(context, 'test'), 'example.net')
Ejemplo n.º 13
0
 def test_get_analytical_domain_from_context(self):
     context = Context({'analytical_domain': 'example.com'})
     self.assertEqual(get_domain(context, 'test'), 'example.com')
Ejemplo n.º 14
0
 def test_get_service_domain_from_context(self):
     context = Context({'test_domain': 'example.com'})
     self.assertEqual(get_domain(context, 'test'), 'example.com')
Ejemplo n.º 15
0
 def test_get_analytical_domain_from_settings(self):
     context = Context()
     assert get_domain(context, 'test') == 'example.org'
Ejemplo n.º 16
0
 def test_get_service_domain_from_settings(self):
     context = Context()
     assert get_domain(context, 'test') == 'example.net'
Ejemplo n.º 17
0
 def test_get_domain_from_site(self):
     site = Site.objects.create(domain="example.com", name="test")
     with override_settings(SITE_ID=site.id):
         context = Context()
         self.assertEqual(get_domain(context, 'test'), 'example.com')
Ejemplo n.º 18
0
 def test_get_service_domain_from_context(self):
     context = Context({'test_domain': 'example.com'})
     assert get_domain(context, 'test') == 'example.com'