|
| 1 | +!(function () { |
| 2 | + var analytics = (window.analytics = window.analytics || []); |
| 3 | + if (!analytics.initialize) |
| 4 | + if (analytics.invoked) |
| 5 | + window.console && |
| 6 | + console.error && |
| 7 | + console.error("Segment snippet included twice."); |
| 8 | + else { |
| 9 | + analytics.invoked = !0; |
| 10 | + analytics.methods = [ |
| 11 | + "trackSubmit", |
| 12 | + "trackClick", |
| 13 | + "trackLink", |
| 14 | + "trackForm", |
| 15 | + "pageview", |
| 16 | + "identify", |
| 17 | + "reset", |
| 18 | + "group", |
| 19 | + "track", |
| 20 | + "ready", |
| 21 | + "alias", |
| 22 | + "debug", |
| 23 | + "page", |
| 24 | + "once", |
| 25 | + "off", |
| 26 | + "on", |
| 27 | + ]; |
| 28 | + analytics.factory = function (t) { |
| 29 | + return function () { |
| 30 | + var e = Array.prototype.slice.call(arguments); |
| 31 | + e.unshift(t); |
| 32 | + analytics.push(e); |
| 33 | + return analytics; |
| 34 | + }; |
| 35 | + }; |
| 36 | + for (var t = 0; t < analytics.methods.length; t++) { |
| 37 | + var e = analytics.methods[t]; |
| 38 | + analytics[e] = analytics.factory(e); |
| 39 | + } |
| 40 | + analytics.load = function (t, e) { |
| 41 | + var n = document.createElement("script"); |
| 42 | + n.type = "text/javascript"; |
| 43 | + n.async = !0; |
| 44 | + n.src = |
| 45 | + "https://sgmnt.envoy.com/analytics.js/v1/" + t + "/analytics.min.js"; |
| 46 | + var a = document.getElementsByTagName("script")[0]; |
| 47 | + a.parentNode.insertBefore(n, a); |
| 48 | + analytics._loadOptions = e; |
| 49 | + }; |
| 50 | + analytics.SNIPPET_VERSION = "4.1.0"; |
| 51 | + |
| 52 | + analytics.load("jmhzjAC1O7mvTJ4taVydJa9YKstvuNME"); |
| 53 | + |
| 54 | + // var page_path = "pages/index.html"; |
| 55 | + // Turn /pages/security.html => security |
| 56 | + // var page_name = page_path.replace(/^pages\// ,'').replace(/\.html$/, '').replace(/\.md$/, ''); |
| 57 | + |
| 58 | + // Get the Page Title |
| 59 | + const pageNameFull = document.title.split("-")[0]; |
| 60 | + // Trim the page title so you only return the first string before a dash |
| 61 | + const pageNameTrimmed = pageNameFull.trim(); |
| 62 | + |
| 63 | + analytics.page( |
| 64 | + "[envoy.com] " + pageNameTrimmed, |
| 65 | + (properties = { project: "envoy.com" }) |
| 66 | + ); |
| 67 | + } |
| 68 | +})(); |
| 69 | + |
| 70 | +window.metrics = { |
| 71 | + trackEvent: function (event, properties, options) { |
| 72 | + if (properties) { |
| 73 | + properties.project = "envoy.com"; |
| 74 | + } else { |
| 75 | + properties = { project: "envoy.com" }; |
| 76 | + } |
| 77 | + analytics.track("[envoy.com] " + event, properties, options); |
| 78 | + }, |
| 79 | +}; |
0 commit comments