Przeglądaj źródła

Added Drift Config

Yoginth 7 lat temu
rodzic
commit
806c56e2d2
1 zmienionych plików z 40 dodań i 26 usunięć
  1. 40 26
      templates/base/verification.tmpl

+ 40 - 26
templates/base/verification.tmpl

@@ -9,32 +9,46 @@
 </script>
 
 <script>
-"use strict";
+  "use strict";
 
-!function() {
-  var t = window.driftt = window.drift = window.driftt || [];
-  if (!t.init) {
-    if (t.invoked) return void (window.console && console.error && console.error("Drift snippet included twice."));
-    t.invoked = !0, t.methods = [ "identify", "config", "track", "reset", "debug", "show", "ping", "page", "hide", "off", "on" ], 
-    t.factory = function(e) {
-      return function() {
-        var n = Array.prototype.slice.call(arguments);
-        return n.unshift(e), t.push(n), t;
+  !function() {
+    var t = window.driftt = window.drift = window.driftt || [];
+    if (!t.init) {
+      if (t.invoked) return void (window.console && console.error && console.error("Drift snippet included twice."));
+      t.invoked = !0, t.methods = [ "identify", "config", "track", "reset", "debug", "show", "ping", "page", "hide", "off", "on" ], 
+      t.factory = function(e) {
+        return function() {
+          var n = Array.prototype.slice.call(arguments);
+          return n.unshift(e), t.push(n), t;
+        };
+      }, t.methods.forEach(function(e) {
+        t[e] = t.factory(e);
+      }), t.load = function(t) {
+        var e = 3e5, n = Math.ceil(new Date() / e) * e, o = document.createElement("script");
+        o.type = "text/javascript", o.async = !0, o.crossorigin = "anonymous", o.src = "https://js.driftt.com/include/" + n + "/" + t + ".js";
+        var i = document.getElementsByTagName("script")[0];
+        i.parentNode.insertBefore(o, i);
       };
-    }, t.methods.forEach(function(e) {
-      t[e] = t.factory(e);
-    }), t.load = function(t) {
-      var e = 3e5, n = Math.ceil(new Date() / e) * e, o = document.createElement("script");
-      o.type = "text/javascript", o.async = !0, o.crossorigin = "anonymous", o.src = "https://js.driftt.com/include/" + n + "/" + t + ".js";
-      var i = document.getElementsByTagName("script")[0];
-      i.parentNode.insertBefore(o, i);
-    };
-  }
-}();
-drift.SNIPPET_VERSION = '0.3.1';
-drift.load('7xn6zh55rcbx');
-drift.identify('{{.LoggedUser.FullName}}', {
-  email: '{{.LoggedUser.Email}}'
-});
-drift.reset();
+    }
+  }();
+  drift.SNIPPET_VERSION = '0.3.1';
+  drift.load('7xn6zh55rcbx');
+  drift.identify('{{.LoggedUser.FullName}}', {
+    email: '{{.LoggedUser.Email}}'
+  });
+  {{if .LoggedUser}}
+  drift.config({
+    locale: '{{.Lang}}',
+    messages: {
+      welcomeMessage: 'Hey {{.LoggedUser.FullName}}!\nHelp, feedback, or bugs? Talk to us 🌞',
+      awayMessage: "Hey, we're not here right now, but leave a message.",
+      emailCaptureMessage: "Leave your email so we can get back to you.",
+      thankYouMessage: "Thanks we'll follow up soon."
+    },
+    enableWelcomeMessage: false,
+    backgroundColor: {{.Owner.ThemeColor}},
+    cookieDomain: '.gitote.in',
+  })
+  {{end}}
+  drift.reset();
 </script>