[pod] Bugfix: error when a pod template does not have a 'mimetype' file inside (https://bugs.launchpad.net/bugs/1173009); bugfix: error when parsing some ods pod templates: some cells do not have attribute 'office:value-type' (see bug https://bugs.launchpad.net/bugs/1173301). [gen] Added a basic integration of gen applications with Google Analytics.
This commit is contained in:
		
							parent
							
								
									1c3555fd28
								
							
						
					
					
						commit
						a94d400d03
					
				
					 7 changed files with 40 additions and 2 deletions
				
			
		|  | @ -1222,4 +1222,29 @@ class ToolMixin(BaseMixin): | |||
|         else: | ||||
|             objects = method.__get__(tool)(tool) | ||||
|         return [(o.uid, o) for o in objects] | ||||
| 
 | ||||
|     def getGoogleAnalyticsCode(self): | ||||
|         '''If the config defined a Google Analytics ID, this method returns the | ||||
|            Javascript code to be included in every page, allowing Google | ||||
|            Analytics to work.''' | ||||
|         # Disable Google Analytics when we are in debug mode. | ||||
|         if self.isDebug(): return | ||||
|         # Disable Google Analytics if no ID is found in the config. | ||||
|         gaId = self.getProductConfig().googleAnalyticsId | ||||
|         if not gaid: return | ||||
|         # Google Analytics must be enabled: return the chunk of Javascript | ||||
|         # code specified by Google. | ||||
|         code = "var _gaq = _gaq || [];\n" \ | ||||
|                "_gaq.push(['_setAccount', '%s']);\n" \ | ||||
|                "_gaq.push(['_trackPageview']);\n" \ | ||||
|                "(function() {\n" \ | ||||
|                "  var ga = document.createElement('script'); " \ | ||||
|                "ga.type = 'text/javascript'; ga.async = true;\n" \ | ||||
|                "  ga.src = ('https:' == document.location.protocol ? " \ | ||||
|                "'https://ssl' : 'http://www') + " \ | ||||
|                "'.google-analytics.com/ga.js';\n" \ | ||||
|                "  var s = document.getElementsByTagName('script')[0]; " \ | ||||
|                "s.parentNode.insertBefore(ga, s);\n" \ | ||||
|                "})();\n" % gaId | ||||
|         return code | ||||
| # ------------------------------------------------------------------------------ | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Gaetan Delannay
						Gaetan Delannay