瀏覽代碼

Add Google Analytics ga.js

Amauri CHAMPEAUX 10 年之前
父節點
當前提交
73262937b9
共有 1 個文件被更改,包括 27 次插入1 次删除
  1. 27 1
      tarteaucitron.services.js

+ 27 - 1
tarteaucitron.services.js

@@ -149,11 +149,37 @@ tarteaucitron.services.adsense = {
     }
     }
 };
 };
 
 
+// google analytics (old)
+tarteaucitron.services.gajs = {
+    "key": "gajs",
+    "type": "analytics",
+    "name": "Google Analytics (ga.js)",
+    "uri": "https://support.google.com/analytics/answer/6004245",
+    "needConsent": true,
+    "js": function () {
+        "use strict";
+        window._gaq = window._gaq || [];
+        window._gaq.push(['_setAccount', tarteaucitron.user.gajsUa]);
+        window._gaq.push(['_trackPageview']);
+        
+        tarteaucitron.addScript('//www.google-analytics.com/ga.js', '', function () {
+            if (typeof tarteaucitron.user.gajsMore === 'function') {
+                tarteaucitron.user.gajsMore();
+            }
+        });
+    },
+    "fallback": function () {
+        "use strict";
+        var cookies = ['_ga', '_gat', '__utma', '__utmb', '__utmc', '__utmt', '__utmz'];
+        tarteaucitron.cookie.purge(cookies);
+    }
+};
+
 // google analytics
 // google analytics
 tarteaucitron.services.analytics = {
 tarteaucitron.services.analytics = {
     "key": "analytics",
     "key": "analytics",
     "type": "analytics",
     "type": "analytics",
-    "name": "Analytics (Google)",
+    "name": "Google Analytics (universal)",
     "uri": "https://support.google.com/analytics/answer/6004245",
     "uri": "https://support.google.com/analytics/answer/6004245",
     "needConsent": true,
     "needConsent": true,
     "js": function () {
     "js": function () {