瀏覽代碼

Add pinterest pixel

Amauri CHAMPEAUX 3 年之前
父節點
當前提交
92c75af8de
共有 1 個文件被更改,包括 31 次插入0 次删除
  1. 31 0
      tarteaucitron.services.js

+ 31 - 0
tarteaucitron.services.js

@@ -32,6 +32,37 @@ tarteaucitron.services.iframe = {
     }
 };
 
+// pinterestpixel
+tarteaucitron.services.pinterestpixel = {
+    "key": "pinterestpixel",
+    "type": "ads",
+    "name": "Pinterest Pixel",
+    "uri": "https://help.pinterest.com/fr/business/article/track-conversions-with-pinterest-tag",
+    "needConsent": true,
+    "cookies": [ '_pinterest_sess', '_pinterest_ct', '_pinterest_ct_mw', '_pinterest_ct_rt', '_epik', '_derived_epik', '_pin_unauth', '_pinterest_ct_ua'],
+    "js": function () {
+        "use strict";
+
+        if (tarteaucitron.user.pinterestpixelId === undefined) {
+            return;
+        }
+
+        if(!window.pintrk) {
+            window.pintrk = function() {
+                window.pintrk.queue.push(Array.prototype.slice.call(arguments));
+            };
+
+            var n=window.pintrk;
+            n.queue=[];
+            n.version="3.0";
+
+            tarteaucitron.addScript('https://s.pinimg.com/ct/core.js', '', function() {
+                window.pintrk('load', tarteaucitron.user.pinterestpixelId);
+                window.pintrk('page');
+            });
+        }
+    }
+};
 
 // elfsight
 tarteaucitron.services.elfsight = {