Google Analytics

Darstellungs-Templates für Google-Analytics präparieren.

SOLUTION: Lediglich zwei Anpassungen sind durchzuführen:
1. Kopieren des von Google ausgegebenen JavaScript-Fragments in das standard_html_footer-Template (unmittelbar vor dem body-Element)
2. Erweiterung der Datei-Links um ein zusätzliches javaScript-Event der Art onClick="javascript:urchinTracker ('/download/zms');"

standard_html_footer

Code-Beispiel für das Zähler-script im standard_html_footer-Template

standard_html_footer

Code-Beispiel für das Zähler-script im standard_html_footer-Template

# Beispiel-Code 1: 
# Ausgabe des Dokument-Pfades 
# erweitert um den finalen File-Namen:
...
onClick="javascript:urchinTracker('<dtml-in "breadcrumbs_obj_path()[1:]"
 >/<dtml-var "getTitlealt(REQUEST)"
 ></dtml-in>/<dtml-var "download_file.getFilename()">')"
...
References: [ZMSLinkElement@/e3493/e736/e947/e2837/howto_refs2839][getObjProperty]: key=standard_html[zpt] Traceback (most recent call last): File "/home/zope211/lib/python/Products/zms/_objattrs.py", line 685, in getObjProperty value = metaObjAttr['zpt'](zmscontext=self) File "/home/zope211/lib/python/Shared/DC/Scripts/Bindings.py", line 313, in __call__ return self._bindAndExec(args, kw, None) File "/home/zope211/lib/python/Shared/DC/Scripts/Bindings.py", line 350, in _bindAndExec return self._exec(bound_data, args, kw) File "/home/zope211/lib/python/Products/PageTemplates/ZopePageTemplate.py", line 330, in _exec result = self.pt_render(extra_context=bound_names) File "/home/zope211/lib/python/Products/PageTemplates/ZopePageTemplate.py", line 427, in pt_render result = PageTemplate.pt_render(self, source, extra_context) File "/home/zope211/lib/python/Products/PageTemplates/PageTemplate.py", line 98, in pt_render showtal=showtal) File "/home/zope211/lib/python/zope/pagetemplate/pagetemplate.py", line 115, in pt_render strictinsert=0, sourceAnnotations=sourceAnnotations)() File "/home/zope211/lib/python/zope/tal/talinterpreter.py", line 271, in __call__ self.interpret(self.program) File "/home/zope211/lib/python/zope/tal/talinterpreter.py", line 346, in interpret handlers[opcode](self, args) File "/home/zope211/lib/python/zope/tal/talinterpreter.py", line 586, in do_setLocal_tal self.engine.setLocal(name, self.engine.evaluateValue(expr)) File "/home/zope211/lib/python/zope/tales/tales.py", line 696, in evaluate return expression(self) File "/home/zope211/lib/python/Products/PageTemplates/ZRPythonExpr.py", line 49, in __call__ return eval(self._code, vars, {}) File "PythonExpr", line 1, in UnicodeDecodeError: 'utf8' codec can't decode bytes in position 48-51: invalid data [ZMSLinkElement@/e3493/e736/e947/e2837/howto_refs2840][getObjProperty]: key=standard_html[zpt] Traceback (most recent call last): File "/home/zope211/lib/python/Products/zms/_objattrs.py", line 685, in getObjProperty value = metaObjAttr['zpt'](zmscontext=self) File "/home/zope211/lib/python/Shared/DC/Scripts/Bindings.py", line 313, in __call__ return self._bindAndExec(args, kw, None) File "/home/zope211/lib/python/Shared/DC/Scripts/Bindings.py", line 350, in _bindAndExec return self._exec(bound_data, args, kw) File "/home/zope211/lib/python/Products/PageTemplates/ZopePageTemplate.py", line 330, in _exec result = self.pt_render(extra_context=bound_names) File "/home/zope211/lib/python/Products/PageTemplates/ZopePageTemplate.py", line 427, in pt_render result = PageTemplate.pt_render(self, source, extra_context) File "/home/zope211/lib/python/Products/PageTemplates/PageTemplate.py", line 98, in pt_render showtal=showtal) File "/home/zope211/lib/python/zope/pagetemplate/pagetemplate.py", line 115, in pt_render strictinsert=0, sourceAnnotations=sourceAnnotations)() File "/home/zope211/lib/python/zope/tal/talinterpreter.py", line 271, in __call__ self.interpret(self.program) File "/home/zope211/lib/python/zope/tal/talinterpreter.py", line 346, in interpret handlers[opcode](self, args) File "/home/zope211/lib/python/zope/tal/talinterpreter.py", line 586, in do_setLocal_tal self.engine.setLocal(name, self.engine.evaluateValue(expr)) File "/home/zope211/lib/python/zope/tales/tales.py", line 696, in evaluate return expression(self) File "/home/zope211/lib/python/Products/PageTemplates/ZRPythonExpr.py", line 49, in __call__ return eval(self._code, vars, {}) File "PythonExpr", line 1, in UnicodeDecodeError: 'utf8' codec can't decode bytes in position 33-38: unsupported Unicode code range

Erstellt von: Dr. F. Hoffmann , erstellt am:  27.06.2008 , zuletzt geändert: 19.07.2008