def render(self, context):
        custom_variables = context.get('piwik_vars', ())

        complete_variables = (var if len(var) >= 4 else var + (DEFAULT_SCOPE,)
                              for var in custom_variables)

        variables_code = (VARIABLE_CODE % PiwikVar(*var)._asdict()
                          for var in complete_variables)

        userid = get_identity(context, 'piwik')
        if userid is not None:
            variables_code = chain(variables_code, (
                IDENTITY_CODE % {'userid': userid},
            ))

        html = TRACKING_CODE % {
            'url': self.domain_path,
            'siteid': self.site_id,
            'variables': '\n  '.join(variables_code)
        }
        if is_internal_ip(context, 'PIWIK'):
            html = disable_html(html, 'Piwik')
        return html
dataset/ETHPy150Open jcassee/django-analytical/analytical/templatetags/piwik.py/PiwikNode.render/original