Example #1
0
 def render(self, context):
     commands = self._get_custom_var_commands(context)
     html = SETUP_CODE % {'property_id': self.property_id,
             'commands': " ".join(commands)}
     if is_internal_ip(context, 'GOOGLE_ANALYTICS'):
         html = disable_html(html, 'Google Analytics')
     return html
Example #2
0
    def render(self, context):
        custom = {}
        for dict_ in context:
            for var, val in dict_.items():
                if var.startswith('clicky_'):
                    custom[var[7:]] = val
        if 'username' not in custom.get('session', {}):
            identity = get_identity(context, 'clicky')
            if identity is not None:
                custom.setdefault('session', {})['username'] = identity

        html = TRACKING_CODE % {'site_id': self.site_id,
                'custom': simplejson.dumps(custom)}
        if is_internal_ip(context, 'CLICKY'):
            html = disable_html(html, 'Clicky')
        return html
    def render(self, context):
        commands = []
        data = context.get('mixpanel')
        commands.append(SUPER_PROPERTY_CODE % (data))
        for name, properties in data.get('events'):
            print 'name=%s, prop=%s' % (name, properties)
            commands.append(EVENT_CODE % {'name': name, 'properties': simplejson.dumps(properties)})

        identity = get_identity(context, 'mixpanel')
        if identity is not None:
            commands.append(IDENTIFY_CODE % (identity, identity))


        html = TRACKING_CODE % {'token': self.token, 'commands': " ".join(commands)}
        if is_internal_ip(context, 'MIXPANEL'):
            html = disable_html(html, 'Mixpanel')
        return html
Example #4
0
    def render(self, context):
        custom = {}
        for dict_ in context:
            for var, val in dict_.items():
                if var.startswith('clicky_'):
                    custom[var[7:]] = val
        if 'username' not in custom.get('session', {}):
            identity = get_identity(context, 'clicky')
            if identity is not None:
                custom.setdefault('session', {})['username'] = identity

        html = TRACKING_CODE % {
            'site_id': self.site_id,
            'custom': simplejson.dumps(custom)
        }
        if is_internal_ip(context, 'CLICKY'):
            html = disable_html(html, 'Clicky')
        return html