Advertisement
Guest User

Adrian-Vender-GTM-Tricks

a guest
Jul 13th, 2015
432
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 55.88 KB | None | 0 0
  1. {
  2. "exportFormatVersion": 1.3,
  3. "exportTime": "2015-07-13 18:06:18",
  4. "containerVersion": {
  5. "accountId": "7155460",
  6. "containerId": "1385556",
  7. "containerVersionId": "0",
  8. "deleted": false,
  9. "container": {
  10. "accountId": "7155460",
  11. "containerId": "1385556",
  12. "name": "GTMTricks",
  13. "publicId": "GTM-MKF3NN",
  14. "timeZoneCountryId": "US",
  15. "timeZoneId": "America/Los_Angeles",
  16. "notes": "",
  17. "usageContext": [
  18. "WEB"
  19. ],
  20. "fingerprint": "1436810766873",
  21. "enabledBuiltInVariable": [
  22. "PAGE_URL",
  23. "PAGE_HOSTNAME",
  24. "PAGE_PATH",
  25. "REFERRER",
  26. "EVENT"
  27. ]
  28. },
  29. "tag": [
  30. {
  31. "accountId": "7155460",
  32. "containerId": "1385556",
  33. "tagId": "47",
  34. "name": "Scroll Tracking Script",
  35. "type": "html",
  36. "liveOnly": false,
  37. "parameter": [
  38. {
  39. "type": "BOOLEAN",
  40. "key": "supportDocumentWrite",
  41. "value": "false"
  42. },
  43. {
  44. "type": "TEMPLATE",
  45. "key": "html",
  46. "value": "<script>\njQuery(function($) {\n // Debug flag\n var debugMode = false;\n\n // Default time delay before checking location\n var callBackTime = 100;\n\n // # px before tracking a reader\n var readerLocation = 150;\n\n // Set some flags for tracking & execution\n var timer = 0;\n var scroller = false;\n var endContent = false;\n var didComplete = false;\n\n // Set some time variables to calculate reading time\n var startTime = new Date();\n var beginning = startTime.getTime();\n var totalTime = 0;\n \n // Get some information about the current page\n var pageTitle = document.title;\n\n // Track the aticle load\n if (!debugMode) {\n ga('send', 'event', 'Reading', pageTitle,'Article Loaded', {'nonInteraction': 1});\n } else {\n alert('The page has loaded. Woohoo.'); \n }\n\n // Check the location and track user\n function trackLocation() {\n bottom = $(window).height() + $(window).scrollTop();\n height = $(document).height();\n\n // If user starts to scroll send an event\n if (bottom > readerLocation && !scroller) {\n currentTime = new Date();\n scrollStart = currentTime.getTime();\n timeToScroll = Math.round((scrollStart - beginning) / 1000);\n if (!debugMode) {\n ga('send', 'event', 'Reading', pageTitle,'Start Reading', timeToScroll, {'metric1' : timeToScroll});\n } else {\n alert('started reading ' + timeToScroll);\n }\n scroller = true;\n }\n\n // If user has hit the bottom of the content send an event\n if (bottom >= $(\"#authorTemplate\").scrollTop() + $(\"#authorTemplate\").innerHeight() && !endContent) {\n currentTime = new Date();\n contentScrollEnd = currentTime.getTime();\n timeToContentEnd = Math.round((contentScrollEnd - scrollStart) / 1000);\n if (!debugMode) {\n if (timeToContentEnd < 60) {\n ga('set', 'dimension1', 'Scanner'); \n } else {\n ga('set', 'dimension1', 'Reader'); \n }\n ga('send', 'event', 'Reading',pageTitle,'Content Bottom', timeToContentEnd, {'metric2' : timeToContentEnd});\n } else {\n alert('end content section '+timeToContentEnd);\n }\n endContent = true;\n }\n\n // If user has hit the bottom of page send an event\n if (bottom >= height && !didComplete) {\n currentTime = new Date();\n end = currentTime.getTime();\n totalTime = Math.round((end - scrollStart) / 1000);\n if (!debugMode) {\n ga('send', 'event', 'Reading', pageTitle,'Page Bottom', totalTime, {'metric3' : totalTime});\n } else {\n alert('bottom of page '+totalTime);\n }\n didComplete = true;\n }\n }\n\n // Track the scrolling and track location\n $(window).scroll(function() {\n if (timer) {\n clearTimeout(timer);\n }\n\n // Use a buffer so we don't call trackLocation too often.\n timer = setTimeout(trackLocation, callBackTime);\n });\n});\n</script>"
  47. }
  48. ],
  49. "fingerprint": "0",
  50. "firingTriggerId": [
  51. "2147479553"
  52. ],
  53. "tagFiringOption": "ONCE_PER_EVENT"
  54. },
  55. {
  56. "accountId": "7155460",
  57. "containerId": "1385556",
  58. "tagId": "48",
  59. "name": "UA - Event - Outbound Links",
  60. "type": "ua",
  61. "liveOnly": false,
  62. "parameter": [
  63. {
  64. "type": "BOOLEAN",
  65. "key": "enableEcommerce",
  66. "value": "false"
  67. },
  68. {
  69. "type": "BOOLEAN",
  70. "key": "doubleClick",
  71. "value": "false"
  72. },
  73. {
  74. "type": "BOOLEAN",
  75. "key": "useDebugVersion",
  76. "value": "false"
  77. },
  78. {
  79. "type": "TEMPLATE",
  80. "key": "trackingId",
  81. "value": "{{UA ID}}"
  82. },
  83. {
  84. "type": "TEMPLATE",
  85. "key": "trackType",
  86. "value": "TRACK_EVENT"
  87. },
  88. {
  89. "type": "BOOLEAN",
  90. "key": "nonInteraction",
  91. "value": "false"
  92. },
  93. {
  94. "type": "BOOLEAN",
  95. "key": "enableLinkId",
  96. "value": "false"
  97. },
  98. {
  99. "type": "TEMPLATE",
  100. "key": "eventAction",
  101. "value": "{{element url}}"
  102. },
  103. {
  104. "type": "TEMPLATE",
  105. "key": "eventCategory",
  106. "value": "OutboundLinks"
  107. }
  108. ],
  109. "fingerprint": "0",
  110. "firingTriggerId": [
  111. "37"
  112. ],
  113. "tagFiringOption": "ONCE_PER_EVENT"
  114. },
  115. {
  116. "accountId": "7155460",
  117. "containerId": "1385556",
  118. "tagId": "49",
  119. "name": "UA - Track Downloads",
  120. "type": "ua",
  121. "liveOnly": false,
  122. "parameter": [
  123. {
  124. "type": "BOOLEAN",
  125. "key": "enableEcommerce",
  126. "value": "false"
  127. },
  128. {
  129. "type": "BOOLEAN",
  130. "key": "doubleClick",
  131. "value": "false"
  132. },
  133. {
  134. "type": "BOOLEAN",
  135. "key": "useDebugVersion",
  136. "value": "false"
  137. },
  138. {
  139. "type": "TEMPLATE",
  140. "key": "trackingId",
  141. "value": "{{UA ID}}"
  142. },
  143. {
  144. "type": "TEMPLATE",
  145. "key": "trackType",
  146. "value": "TRACK_EVENT"
  147. },
  148. {
  149. "type": "BOOLEAN",
  150. "key": "nonInteraction",
  151. "value": "false"
  152. },
  153. {
  154. "type": "BOOLEAN",
  155. "key": "enableLinkId",
  156. "value": "false"
  157. },
  158. {
  159. "type": "TEMPLATE",
  160. "key": "eventAction",
  161. "value": "{{Click URL Path}}"
  162. },
  163. {
  164. "type": "TEMPLATE",
  165. "key": "eventCategory",
  166. "value": "Downloads"
  167. }
  168. ],
  169. "fingerprint": "0",
  170. "firingTriggerId": [
  171. "38"
  172. ],
  173. "tagFiringOption": "ONCE_PER_EVENT"
  174. },
  175. {
  176. "accountId": "7155460",
  177. "containerId": "1385556",
  178. "tagId": "43",
  179. "name": "UA - Vimeo Event",
  180. "type": "ua",
  181. "liveOnly": false,
  182. "parameter": [
  183. {
  184. "type": "BOOLEAN",
  185. "key": "enableEcommerce",
  186. "value": "false"
  187. },
  188. {
  189. "type": "TEMPLATE",
  190. "key": "eventValue",
  191. "value": "{{Vimeo Event Value}}"
  192. },
  193. {
  194. "type": "BOOLEAN",
  195. "key": "doubleClick",
  196. "value": "true"
  197. },
  198. {
  199. "type": "BOOLEAN",
  200. "key": "useDebugVersion",
  201. "value": "false"
  202. },
  203. {
  204. "type": "TEMPLATE",
  205. "key": "trackingId",
  206. "value": "{{UA ID}}"
  207. },
  208. {
  209. "type": "TEMPLATE",
  210. "key": "trackType",
  211. "value": "TRACK_EVENT"
  212. },
  213. {
  214. "type": "TEMPLATE",
  215. "key": "nonInteraction",
  216. "value": "{{Vimeo Event Non-Interaction}}"
  217. },
  218. {
  219. "type": "TEMPLATE",
  220. "key": "eventLabel",
  221. "value": "{{Vimeo Event Label}}"
  222. },
  223. {
  224. "type": "BOOLEAN",
  225. "key": "enableLinkId",
  226. "value": "false"
  227. },
  228. {
  229. "type": "TEMPLATE",
  230. "key": "eventAction",
  231. "value": "{{Vimeo Event Action}}"
  232. },
  233. {
  234. "type": "TEMPLATE",
  235. "key": "eventCategory",
  236. "value": "{{Vimeo Event Category}}"
  237. }
  238. ],
  239. "fingerprint": "0",
  240. "firingTriggerId": [
  241. "30"
  242. ],
  243. "tagFiringOption": "ONCE_PER_EVENT"
  244. },
  245. {
  246. "accountId": "7155460",
  247. "containerId": "1385556",
  248. "tagId": "44",
  249. "name": "UA - YouTube Event",
  250. "type": "ua",
  251. "liveOnly": false,
  252. "parameter": [
  253. {
  254. "type": "BOOLEAN",
  255. "key": "enableEcommerce",
  256. "value": "false"
  257. },
  258. {
  259. "type": "LIST",
  260. "key": "fieldsToSet",
  261. "list": [
  262. {
  263. "type": "MAP",
  264. "map": [
  265. {
  266. "type": "TEMPLATE",
  267. "key": "fieldName",
  268. "value": "useBeacon"
  269. },
  270. {
  271. "type": "TEMPLATE",
  272. "key": "value",
  273. "value": "true"
  274. }
  275. ]
  276. }
  277. ]
  278. },
  279. {
  280. "type": "BOOLEAN",
  281. "key": "doubleClick",
  282. "value": "true"
  283. },
  284. {
  285. "type": "BOOLEAN",
  286. "key": "useDebugVersion",
  287. "value": "false"
  288. },
  289. {
  290. "type": "TEMPLATE",
  291. "key": "trackingId",
  292. "value": "{{UA ID}}"
  293. },
  294. {
  295. "type": "TEMPLATE",
  296. "key": "trackType",
  297. "value": "TRACK_EVENT"
  298. },
  299. {
  300. "type": "BOOLEAN",
  301. "key": "nonInteraction",
  302. "value": "false"
  303. },
  304. {
  305. "type": "TEMPLATE",
  306. "key": "eventLabel",
  307. "value": "{{dataLayer label}}"
  308. },
  309. {
  310. "type": "BOOLEAN",
  311. "key": "enableLinkId",
  312. "value": "false"
  313. },
  314. {
  315. "type": "TEMPLATE",
  316. "key": "eventAction",
  317. "value": "{{dataLayer action}}"
  318. },
  319. {
  320. "type": "TEMPLATE",
  321. "key": "eventCategory",
  322. "value": "{{dataLayer category}}"
  323. }
  324. ],
  325. "fingerprint": "0",
  326. "firingTriggerId": [
  327. "34"
  328. ],
  329. "tagFiringOption": "ONCE_PER_EVENT"
  330. },
  331. {
  332. "accountId": "7155460",
  333. "containerId": "1385556",
  334. "tagId": "45",
  335. "name": "Vimeo Tracking",
  336. "type": "html",
  337. "liveOnly": false,
  338. "parameter": [
  339. {
  340. "type": "BOOLEAN",
  341. "key": "supportDocumentWrite",
  342. "value": "false"
  343. },
  344. {
  345. "type": "TEMPLATE",
  346. "key": "html",
  347. "value": "<script>\n/*\n * vimeo.ga.js | v0.5.1\n * Based on modifications by LukasBeaton (https://github.com/LukasBeaton/vimeo.ga.js)\n * Copyright (c) 2015 Sander Heilbron (http://www.sanderheilbron.nl)\n * MIT licensed\n */\n\n\nvar vimeoGAJS = {};\n(function($){vimeoGAJS={\n iframes : [],\n gaTracker : undefined,\n eventMarker : {},\n\n init: function () {\n vimeoGAJS.iframes = $('iframe');\n\n $.each(vimeoGAJS.iframes, function (index, iframe) {\n var iframeId = $(iframe).attr('id');\n\n vimeoGAJS.eventMarker[iframeId] = {\n \t'progress25' : false,\n 'progress50' : false,\n 'progress75' : false,\n 'videoPlayed' : false,\n 'videoPaused' : false,\n 'videoResumed' : false,\n 'videoSeeking' : false,\n 'videoCompleted' : false,\n 'timePercentComplete' : 0\n };\n });\n\n // Check which version of Google Analytics is used\n if (typeof ga === \"function\") {\n vimeoGAJS.gaTracker = 'ua'; // Universal Analytics (universal.js)\n //console.info('Universal Analytics');\n }\n\n if (typeof _gaq !== \"undefined\" && typeof _gaq.push === \"function\") {\n vimeoGAJS.gaTracker = 'ga'; // Classic Analytics (ga.js)\n //console.info('Classic Analytics');\n }\n\n if (typeof dataLayer !== \"undefined\" && typeof dataLayer.push === \"function\") {\n vimeoGAJS.gaTracker = 'gtm'; // Google Tag Manager (dataLayer)\n //console.info('Google Tag Manager');\n }\n\n // Listen for messages from the player\n if (window.addEventListener) {\n window.addEventListener('message', vimeoGAJS.onMessageReceived, false);\n } else {\n window.attachEvent('onmessage', vimeoGAJS.onMessageReceived, false);\n }\n },\n\n // Handle messages received from the player\n onMessageReceived: function(e) {\n if (e.origin.replace('https:', 'http:') !== \"http://player.vimeo.com\" || typeof vimeoGAJS.gaTracker === 'undefined') {\n //console.warn('Tracker is missing!');\n return;\n }\n\n var data = JSON.parse(e.data),\n iframeEl = $(\"#\"+data.player_id),\n iframeId = iframeEl.attr('id');\n\n switch (data.event) {\n case 'ready':\n vimeoGAJS.onReady();\n break;\n\n case 'playProgress':\n vimeoGAJS.onPlayProgress(data.data, iframeEl);\n break;\n\n case 'seek':\n if (iframeEl.data('seek') && !vimeoGAJS.eventMarker[iframeId].videoSeeking) {\n vimeoGAJS.sendEvent(iframeEl, 'Skipped video forward or backward');\n vimeoGAJS.eventMarker[iframeId].videoSeeking = true; // Avoid subsequent seek trackings\n }\n break;\n\n case 'play':\n if (!vimeoGAJS.eventMarker[iframeId].videoPlayed) {\n vimeoGAJS.sendEvent(iframeEl, 'Started video');\n vimeoGAJS.eventMarker[iframeId].videoPlayed = true; // Avoid subsequent play trackings\n } else if (!vimeoGAJS.eventMarker[iframeId].videoResumed && vimeoGAJS.eventMarker[iframeId].videoPaused) {\n vimeoGAJS.sendEvent(iframeEl, 'Resumed video');\n vimeoGAJS.eventMarker[iframeId].videoResumed = true; // Avoid subsequent resume trackings\n }\n break;\n\n case 'pause':\n vimeoGAJS.onPause(iframeEl);\n break;\n\n case 'finish':\n if (!vimeoGAJS.eventMarker[iframeId].videoCompleted) {\n vimeoGAJS.sendEvent(iframeEl, 'Completed video');\n vimeoGAJS.eventMarker[iframeId].videoCompleted = true; // Avoid subsequent finish trackings\n }\n break;\n }\n },\n\n getUrl : function (iframeSrc) {\n // Domain protocol (http or https)\n var protocol = document.URL.split(':')[0];\n\n // If protocol not present add what is in document.URL and return full src\n if (iframeSrc.match(/^http/) === null) {\n return protocol + ':' + iframeSrc;\n }\n // Return original source\n return iframeSrc;\n },\n\n getLabel : function(iframeEl) {\n var iframeSrc = iframeEl.attr('src').split('?')[0];\n var label = vimeoGAJS.getUrl(iframeSrc);\n if (iframeEl.data('title')) {\n label += ' (' + iframeEl.data('title') + ')';\n } else if (iframeEl.attr('title')) {\n label += ' (' + iframeEl.attr('title') + ')';\n }\n return label;\n },\n\n // Helper function for sending a message to the player\n post : function (action, value, iframe) {\n var data = {\n method: action\n };\n\n if (value) {\n data.value = value;\n }\n\n // Source URL\n var iframeSrc = $(iframe).attr('src').split('?')[0];\n\n iframe.contentWindow.postMessage(JSON.stringify(data), vimeoGAJS.getUrl(iframeSrc));\n },\n\n onReady :function() {\n $.each(vimeoGAJS.iframes, function(index, iframe) {\n vimeoGAJS.post('addEventListener', 'play', iframe);\n vimeoGAJS.post('addEventListener', 'seek', iframe);\n vimeoGAJS.post('addEventListener', 'pause', iframe);\n vimeoGAJS.post('addEventListener', 'finish', iframe);\n vimeoGAJS.post('addEventListener', 'playProgress', iframe);\n });\n },\n\n onPause: function(iframeEl) {\n var iframeId = iframeEl.attr('id');\n if (vimeoGAJS.eventMarker[iframeId].timePercentComplete < 99 && !vimeoGAJS.eventMarker[iframeId].videoPaused) {\n vimeoGAJS.sendEvent(iframeEl, 'Paused video');\n vimeoGAJS.eventMarker[iframeId].videoPaused = true; // Avoid subsequent pause trackings\n }\n },\n\n // Tracking video progress\n onPlayProgress: function(data, iframeEl) {\n var progress,\n iframeId = iframeEl.attr('id');\n vimeoGAJS.eventMarker[iframeId].timePercentComplete = Math.round((data.percent) * 100); // Round to a whole number\n\n if (!iframeEl.data('progress')) {\n return;\n }\n\n if (vimeoGAJS.eventMarker[iframeId].timePercentComplete > 24 && !vimeoGAJS.eventMarker[iframeId].progress25) {\n progress = 'Played video: 25%';\n vimeoGAJS.eventMarker[iframeId].progress25 = true;\n }\n\n if (vimeoGAJS.eventMarker[iframeId].timePercentComplete > 49 && !vimeoGAJS.eventMarker[iframeId].progress50) {\n progress = 'Played video: 50%';\n vimeoGAJS.eventMarker[iframeId].progress50 = true;\n }\n\n if (vimeoGAJS.eventMarker[iframeId].timePercentComplete > 74 && !vimeoGAJS.eventMarker[iframeId].progress75) {\n progress = 'Played video: 75%';\n vimeoGAJS.eventMarker[iframeId].progress75 = true;\n }\n\n if (progress) {\n vimeoGAJS.sendEvent(iframeEl, progress);\n }\n },\n\n // Send event to Classic Analytics, Universal Analytics or Google Tag Manager\n sendEvent: function (iframeEl, action) {\n var bounce = iframeEl.data('bounce');\n var label = vimeoGAJS.getLabel(iframeEl);\n\n switch (vimeoGAJS.gaTracker) {\n case 'gtm':\n dataLayer.push({'event': 'Vimeo', 'eventCategory': 'Vimeo', 'eventAction': action, 'eventLabel': label, 'eventValue': undefined, 'eventNonInteraction': (bounce) ? false : true });\n break;\n\n case 'ua':\n ga('send', 'event', 'Vimeo', action, label, undefined, {'nonInteraction': (bounce) ? 0 : 1});\n break;\n\n case 'ga':\n _gaq.push(['_trackEvent', 'Vimeo', action, label, undefined, (bounce) ? false : true]);\n break;\n }\n }\n};\nvimeoGAJS.init();\n})(jQuery);\n</script>"
  348. }
  349. ],
  350. "fingerprint": "0",
  351. "firingTriggerId": [
  352. "36"
  353. ],
  354. "tagFiringOption": "ONCE_PER_EVENT"
  355. },
  356. {
  357. "accountId": "7155460",
  358. "containerId": "1385556",
  359. "tagId": "46",
  360. "name": "YouTube Listener",
  361. "type": "html",
  362. "liveOnly": false,
  363. "parameter": [
  364. {
  365. "type": "BOOLEAN",
  366. "key": "supportDocumentWrite",
  367. "value": "false"
  368. },
  369. {
  370. "type": "TEMPLATE",
  371. "key": "html",
  372. "value": "<!--\nGoogle Analytics Tag Manager (V2) custom HTML tag for YouTube video tracking\n\nCopyright 2015, Cardinal Path, Inc.\n\nOriginal author: Stephane Hamel <shamel@cardinalpath.com>\nRevised by: Nicky Yuen <nyuen@cardinalpath.com>\n\nVersion 1.0\n-->\n<script type=\"text/javascript\">\n\t// support multiple players on the same page\n\tvar gtmYTPlayers = [];\n\t\n // OPTIONAL: Enable JSAPI if it's not already on the URL\n // note: this will cause the YouTube player to \"flash\" on the page when reloading to enable the JS API\n for (var e = document.getElementsByTagName(\"iframe\"), x = e.length; x--;)\n if (/youtube.com\\/embed/.test(e[x].src))\n if (e[x].src.indexOf('enablejsapi=') === -1)\n e[x].src += (e[x].src.indexOf('?') === -1 ? '?' : '&') + 'enablejsapi=1';\n\t\t\n\t/**\n\t * Attaches listener once the YouTube API is loaded\t\n\t**/\n function onYouTubeIframeAPIReady() {\n for (var e = document.getElementsByTagName(\"iframe\"), x = e.length; x--;) {\n if (/youtube.com\\/embed/.test(e[x].src)) {\n gtmYTPlayers.push(new YT.Player(e[x], {\n events: {\n onStateChange: onPlayerStateChange,\n onError: onPlayerError\n }\n }));\n YT.gtmLastAction = \"p\";\n }\n }\n }\n\n\t/**\n\t * Listen for play/pause. Other states such as rewind and end could also be added\n * Also report % played every second\n\t * @param e - event\n\t**/\n function onPlayerStateChange(e) {\n e[\"data\"] == YT.PlayerState.PLAYING && setTimeout(onPlayerPercent, 1000, e[\"target\"]);\n var video_data = e.target[\"getVideoData\"](),\n label = video_data.video_id + ':' + video_data.title;\n if (e[\"data\"] == YT.PlayerState.PLAYING && YT.gtmLastAction == \"p\") {\n dataLayer.push({\n event: 'youtube',\n eventCategory: 'youtube',\n\t\t\t\teventAction: 'play',\n eventLabel: label\n });\n YT.gtmLastAction = \"\";\n }\n if (e[\"data\"] == YT.PlayerState.PAUSED) {\n dataLayer.push({\n event: 'youtube',\n eventCategory: 'youtube',\n\t\t\t\teventAction: 'pause',\n eventLabel: label\n });\n YT.gtmLastAction = \"p\";\n }\n }\n\n\t/**\n\t * Catch all to report errors through the GTM data layer. once the error is exposed to GTM, it can be tracked in UA as an event!\n\t * Refer to https://developers.google.com/youtube/js_api_reference#Events onError\n\t * @param: e (event)\n\t**/\n \n function onPlayerError(e) {\n dataLayer.push({\n event: 'error',\n\t\t\teventCategory: 'youtube',\n\t\t\teventAction: 'play',\n eventLabel: 'youtube: ' + e\n })\n }\n\n\t/**\n\t * Report the % played if it matches 0%, 25%, 50%, 75%, 90% or completed\n\t * @param: e (event)\n\t**/\n function onPlayerPercent(e) {\n if (e[\"getPlayerState\"]() == YT.PlayerState.PLAYING) {\n //var t = e[\"getDuration\"]() - e[\"getCurrentTime\"]() <= 1.5 ? 1 : (Math.floor(e[\"getCurrentTime\"]() / e[\"getDuration\"]() * 4) / 4).toFixed(2);\n \n // Set the played duration to every tenth because we'll need to also capture 90% played.\n var t = e[\"getDuration\"]() - e[\"getCurrentTime\"]() <= 1.5 ? 1 : (Math.floor(e[\"getCurrentTime\"]() / e[\"getDuration\"]() * 10) / 10).toFixed(2);\n \n if (parseFloat(t) < 0.25) {\n t = 0.00;\n }\n else if (parseFloat(t) < 0.5){\n t = 0.25;\n }\n else if (parseFloat(t) < 0.75){\n t = 0.50;\n }\n else if (parseFloat(t) < 0.9){\n t = 0.75;\n }\n else if (parseFloat(t) < 1){\n t = 0.90;\n }\n // duration t needs to be fixed to 2 decimal places\n t = t.toFixed(2);\n \n if (!e[\"lastP\"] || t > e[\"lastP\"]) {\n var video_data = e[\"getVideoData\"](),\n label = video_data.video_id + ':' + video_data.title;\n e[\"lastP\"] = t;\n dataLayer.push({\n event: \"youtube\",\n eventCategory: 'youtube',\n eventAction: t * 100 + \"%\",\n eventLabel: label\n })\n }\n e[\"lastP\"] != 1 && setTimeout(onPlayerPercent, 1000, e);\n }\n }\n\t\n\t/**\n\t * Add unload event listener\n\t**/\n\twindow.addEventListener('beforeunload', function(e){\n\t\tfor (var i = 0; i < gtmYTPlayers.length; i++){\n\t\t\tif (gtmYTPlayers[i].getPlayerState() === 1) { // playing\n\t\t\t\tvar video_data = gtmYTPlayers[i]['getVideoData'](),\n\t\t\t\tlabel = video_data.video_id + ':' + video_data.title;\n\t\t\t\t\n\t\t\t\tdataLayer.push({\n\t\t\t\t\tevent: 'youtube',\n\t\t\t\t\teventCategory: 'youtube',\n\t\t\t\t\teventAction: 'exit',\n\t\t\t\t\teventLabel: label\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t})\n \n\t// load the Youtube JS api and get going\n var j = document.createElement(\"script\"),\n f = document.getElementsByTagName(\"script\")[0];\n j.src = \"//www.youtube.com/iframe_api\";\n j.async = true;\n f.parentNode.insertBefore(j, f);\n</script>"
  373. }
  374. ],
  375. "fingerprint": "0",
  376. "firingTriggerId": [
  377. "35"
  378. ],
  379. "tagFiringOption": "ONCE_PER_EVENT"
  380. }
  381. ],
  382. "fingerprint": "0",
  383. "trigger": [
  384. {
  385. "accountId": "7155460",
  386. "containerId": "1385556",
  387. "triggerId": "19",
  388. "name": "All pages",
  389. "type": "PAGEVIEW",
  390. "filter": [
  391. {
  392. "type": "MATCH_REGEX",
  393. "parameter": [
  394. {
  395. "type": "TEMPLATE",
  396. "key": "arg0",
  397. "value": "{{url}}"
  398. },
  399. {
  400. "type": "TEMPLATE",
  401. "key": "arg1",
  402. "value": ".*"
  403. }
  404. ]
  405. }
  406. ],
  407. "fingerprint": "0"
  408. },
  409. {
  410. "accountId": "7155460",
  411. "containerId": "1385556",
  412. "triggerId": "38",
  413. "name": "Click - Link click on downloadable",
  414. "type": "LINK_CLICK",
  415. "filter": [
  416. {
  417. "type": "MATCH_REGEX",
  418. "parameter": [
  419. {
  420. "type": "TEMPLATE",
  421. "key": "arg0",
  422. "value": "{{Click URL Path}}"
  423. },
  424. {
  425. "type": "TEMPLATE",
  426. "key": "arg1",
  427. "value": "\\.(ext1|ext2|ext3)$"
  428. }
  429. ]
  430. }
  431. ],
  432. "autoEventFilter": [
  433. {
  434. "type": "MATCH_REGEX",
  435. "parameter": [
  436. {
  437. "type": "TEMPLATE",
  438. "key": "arg0",
  439. "value": "{{Page URL}}"
  440. },
  441. {
  442. "type": "TEMPLATE",
  443. "key": "arg1",
  444. "value": ".*"
  445. }
  446. ]
  447. }
  448. ],
  449. "waitForTags": {
  450. "type": "BOOLEAN",
  451. "value": "true"
  452. },
  453. "checkValidation": {
  454. "type": "BOOLEAN",
  455. "value": "true"
  456. },
  457. "waitForTagsTimeout": {
  458. "type": "TEMPLATE",
  459. "value": "2000"
  460. },
  461. "uniqueTriggerId": {
  462. "type": "TEMPLATE",
  463. "value": ""
  464. },
  465. "fingerprint": "0"
  466. },
  467. {
  468. "accountId": "7155460",
  469. "containerId": "1385556",
  470. "triggerId": "30",
  471. "name": "Only Vimeo",
  472. "type": "CUSTOM_EVENT",
  473. "customEventFilter": [
  474. {
  475. "type": "EQUALS",
  476. "parameter": [
  477. {
  478. "type": "TEMPLATE",
  479. "key": "arg0",
  480. "value": "{{_event}}"
  481. },
  482. {
  483. "type": "TEMPLATE",
  484. "key": "arg1",
  485. "value": "Vimeo"
  486. }
  487. ]
  488. }
  489. ],
  490. "fingerprint": "0"
  491. },
  492. {
  493. "accountId": "7155460",
  494. "containerId": "1385556",
  495. "triggerId": "37",
  496. "name": "Outbound Links",
  497. "type": "LINK_CLICK",
  498. "filter": [
  499. {
  500. "type": "CONTAINS",
  501. "parameter": [
  502. {
  503. "type": "TEMPLATE",
  504. "key": "arg0",
  505. "value": "{{Click URL Hostname}}"
  506. },
  507. {
  508. "type": "TEMPLATE",
  509. "key": "arg1",
  510. "value": "mydomain.com"
  511. },
  512. {
  513. "type": "BOOLEAN",
  514. "key": "negate",
  515. "value": "true"
  516. }
  517. ]
  518. }
  519. ],
  520. "autoEventFilter": [
  521. {
  522. "type": "MATCH_REGEX",
  523. "parameter": [
  524. {
  525. "type": "TEMPLATE",
  526. "key": "arg0",
  527. "value": "{{Page URL}}"
  528. },
  529. {
  530. "type": "TEMPLATE",
  531. "key": "arg1",
  532. "value": ".*"
  533. }
  534. ]
  535. }
  536. ],
  537. "waitForTags": {
  538. "type": "BOOLEAN",
  539. "value": "true"
  540. },
  541. "checkValidation": {
  542. "type": "BOOLEAN",
  543. "value": "true"
  544. },
  545. "waitForTagsTimeout": {
  546. "type": "TEMPLATE",
  547. "value": "2000"
  548. },
  549. "uniqueTriggerId": {
  550. "type": "TEMPLATE",
  551. "value": ""
  552. },
  553. "fingerprint": "0"
  554. },
  555. {
  556. "accountId": "7155460",
  557. "containerId": "1385556",
  558. "triggerId": "34",
  559. "name": "YouTube event",
  560. "type": "CUSTOM_EVENT",
  561. "customEventFilter": [
  562. {
  563. "type": "EQUALS",
  564. "parameter": [
  565. {
  566. "type": "TEMPLATE",
  567. "key": "arg0",
  568. "value": "{{_event}}"
  569. },
  570. {
  571. "type": "TEMPLATE",
  572. "key": "arg1",
  573. "value": "youtube"
  574. }
  575. ]
  576. }
  577. ],
  578. "fingerprint": "0"
  579. },
  580. {
  581. "accountId": "7155460",
  582. "containerId": "1385556",
  583. "triggerId": "35",
  584. "name": "YouTube present",
  585. "type": "CUSTOM_EVENT",
  586. "customEventFilter": [
  587. {
  588. "type": "EQUALS",
  589. "parameter": [
  590. {
  591. "type": "TEMPLATE",
  592. "key": "arg0",
  593. "value": "{{_event}}"
  594. },
  595. {
  596. "type": "TEMPLATE",
  597. "key": "arg1",
  598. "value": "gtm.dom"
  599. }
  600. ]
  601. }
  602. ],
  603. "filter": [
  604. {
  605. "type": "EQUALS",
  606. "parameter": [
  607. {
  608. "type": "TEMPLATE",
  609. "key": "arg0",
  610. "value": "{{YouTube is present}}"
  611. },
  612. {
  613. "type": "TEMPLATE",
  614. "key": "arg1",
  615. "value": "true"
  616. }
  617. ]
  618. }
  619. ],
  620. "fingerprint": "0"
  621. },
  622. {
  623. "accountId": "7155460",
  624. "containerId": "1385556",
  625. "triggerId": "36",
  626. "name": "gtm.dom",
  627. "type": "CUSTOM_EVENT",
  628. "customEventFilter": [
  629. {
  630. "type": "EQUALS",
  631. "parameter": [
  632. {
  633. "type": "TEMPLATE",
  634. "key": "arg0",
  635. "value": "{{_event}}"
  636. },
  637. {
  638. "type": "TEMPLATE",
  639. "key": "arg1",
  640. "value": "gtm.dom"
  641. }
  642. ]
  643. }
  644. ],
  645. "fingerprint": "0"
  646. }
  647. ],
  648. "variable": [
  649. {
  650. "accountId": "7155460",
  651. "containerId": "1385556",
  652. "variableId": "37",
  653. "name": "Auto Event Element Class",
  654. "type": "aev",
  655. "parameter": [
  656. {
  657. "type": "TEMPLATE",
  658. "key": "varType",
  659. "value": "CLASSES"
  660. }
  661. ],
  662. "fingerprint": "0"
  663. },
  664. {
  665. "accountId": "7155460",
  666. "containerId": "1385556",
  667. "variableId": "34",
  668. "name": "Auto Event Element URL",
  669. "type": "aev",
  670. "parameter": [
  671. {
  672. "type": "TEMPLATE",
  673. "key": "component",
  674. "value": "URL"
  675. },
  676. {
  677. "type": "TEMPLATE",
  678. "key": "varType",
  679. "value": "URL"
  680. }
  681. ],
  682. "fingerprint": "0"
  683. },
  684. {
  685. "accountId": "7155460",
  686. "containerId": "1385556",
  687. "variableId": "61",
  688. "name": "Click URL Hostname",
  689. "type": "aev",
  690. "parameter": [
  691. {
  692. "type": "BOOLEAN",
  693. "key": "stripWww",
  694. "value": "false"
  695. },
  696. {
  697. "type": "TEMPLATE",
  698. "key": "component",
  699. "value": "HOST"
  700. },
  701. {
  702. "type": "TEMPLATE",
  703. "key": "varType",
  704. "value": "URL"
  705. }
  706. ],
  707. "fingerprint": "0"
  708. },
  709. {
  710. "accountId": "7155460",
  711. "containerId": "1385556",
  712. "variableId": "62",
  713. "name": "Click URL Path",
  714. "type": "aev",
  715. "parameter": [
  716. {
  717. "type": "LIST",
  718. "key": "defaultPages"
  719. },
  720. {
  721. "type": "TEMPLATE",
  722. "key": "component",
  723. "value": "PATH"
  724. },
  725. {
  726. "type": "TEMPLATE",
  727. "key": "varType",
  728. "value": "URL"
  729. }
  730. ],
  731. "fingerprint": "0"
  732. },
  733. {
  734. "accountId": "7155460",
  735. "containerId": "1385556",
  736. "variableId": "39",
  737. "name": "UA ID",
  738. "type": "c",
  739. "parameter": [
  740. {
  741. "type": "TEMPLATE",
  742. "key": "value",
  743. "value": "UA-11111-1"
  744. }
  745. ],
  746. "fingerprint": "0"
  747. },
  748. {
  749. "accountId": "7155460",
  750. "containerId": "1385556",
  751. "variableId": "40",
  752. "name": "Vimeo Event Action",
  753. "type": "v",
  754. "parameter": [
  755. {
  756. "type": "TEMPLATE",
  757. "key": "name",
  758. "value": "eventAction"
  759. },
  760. {
  761. "type": "INTEGER",
  762. "key": "dataLayerVersion",
  763. "value": "2"
  764. }
  765. ],
  766. "fingerprint": "0"
  767. },
  768. {
  769. "accountId": "7155460",
  770. "containerId": "1385556",
  771. "variableId": "41",
  772. "name": "Vimeo Event Category",
  773. "type": "v",
  774. "parameter": [
  775. {
  776. "type": "BOOLEAN",
  777. "key": "setDefaultValue",
  778. "value": "true"
  779. },
  780. {
  781. "type": "TEMPLATE",
  782. "key": "name",
  783. "value": "eventCategory"
  784. },
  785. {
  786. "type": "INTEGER",
  787. "key": "dataLayerVersion",
  788. "value": "2"
  789. },
  790. {
  791. "type": "TEMPLATE",
  792. "key": "defaultValue",
  793. "value": "Vimeo"
  794. }
  795. ],
  796. "fingerprint": "0"
  797. },
  798. {
  799. "accountId": "7155460",
  800. "containerId": "1385556",
  801. "variableId": "42",
  802. "name": "Vimeo Event Label",
  803. "type": "v",
  804. "parameter": [
  805. {
  806. "type": "TEMPLATE",
  807. "key": "name",
  808. "value": "eventLabel"
  809. },
  810. {
  811. "type": "INTEGER",
  812. "key": "dataLayerVersion",
  813. "value": "2"
  814. }
  815. ],
  816. "fingerprint": "0"
  817. },
  818. {
  819. "accountId": "7155460",
  820. "containerId": "1385556",
  821. "variableId": "43",
  822. "name": "Vimeo Event Non-Interaction",
  823. "type": "v",
  824. "parameter": [
  825. {
  826. "type": "TEMPLATE",
  827. "key": "name",
  828. "value": "eventNonInteraction"
  829. },
  830. {
  831. "type": "INTEGER",
  832. "key": "dataLayerVersion",
  833. "value": "2"
  834. }
  835. ],
  836. "fingerprint": "0"
  837. },
  838. {
  839. "accountId": "7155460",
  840. "containerId": "1385556",
  841. "variableId": "44",
  842. "name": "Vimeo Event Value",
  843. "type": "v",
  844. "parameter": [
  845. {
  846. "type": "TEMPLATE",
  847. "key": "name",
  848. "value": "eventValue"
  849. },
  850. {
  851. "type": "INTEGER",
  852. "key": "dataLayerVersion",
  853. "value": "2"
  854. }
  855. ],
  856. "fingerprint": "0"
  857. },
  858. {
  859. "accountId": "7155460",
  860. "containerId": "1385556",
  861. "variableId": "38",
  862. "name": "YouTube is present",
  863. "type": "jsm",
  864. "parameter": [
  865. {
  866. "type": "TEMPLATE",
  867. "key": "javascript",
  868. "value": "// Return \"true\" if there is at least one YouTube video on the page\nfunction () {\n for (var e = document.getElementsByTagName('iframe'), x = e.length; x--;)\n if (/youtube.com\\/embed/.test(e[x].src)){\n return true;\n }\n return false;\n}"
  869. }
  870. ],
  871. "fingerprint": "0"
  872. },
  873. {
  874. "accountId": "7155460",
  875. "containerId": "1385556",
  876. "variableId": "45",
  877. "name": "dataLayer action",
  878. "type": "v",
  879. "parameter": [
  880. {
  881. "type": "TEMPLATE",
  882. "key": "name",
  883. "value": "eventAction"
  884. },
  885. {
  886. "type": "INTEGER",
  887. "key": "dataLayerVersion",
  888. "value": "2"
  889. }
  890. ],
  891. "fingerprint": "0"
  892. },
  893. {
  894. "accountId": "7155460",
  895. "containerId": "1385556",
  896. "variableId": "46",
  897. "name": "dataLayer category",
  898. "type": "v",
  899. "parameter": [
  900. {
  901. "type": "TEMPLATE",
  902. "key": "name",
  903. "value": "eventCategory"
  904. },
  905. {
  906. "type": "INTEGER",
  907. "key": "dataLayerVersion",
  908. "value": "2"
  909. }
  910. ],
  911. "fingerprint": "0"
  912. },
  913. {
  914. "accountId": "7155460",
  915. "containerId": "1385556",
  916. "variableId": "47",
  917. "name": "dataLayer label",
  918. "type": "v",
  919. "parameter": [
  920. {
  921. "type": "TEMPLATE",
  922. "key": "name",
  923. "value": "eventLabel"
  924. },
  925. {
  926. "type": "INTEGER",
  927. "key": "dataLayerVersion",
  928. "value": "2"
  929. }
  930. ],
  931. "fingerprint": "0"
  932. },
  933. {
  934. "accountId": "7155460",
  935. "containerId": "1385556",
  936. "variableId": "48",
  937. "name": "element",
  938. "type": "aev",
  939. "parameter": [
  940. {
  941. "type": "TEMPLATE",
  942. "key": "varType",
  943. "value": "ELEMENT"
  944. }
  945. ],
  946. "fingerprint": "0"
  947. },
  948. {
  949. "accountId": "7155460",
  950. "containerId": "1385556",
  951. "variableId": "35",
  952. "name": "element classes",
  953. "type": "aev",
  954. "parameter": [
  955. {
  956. "type": "TEMPLATE",
  957. "key": "varType",
  958. "value": "CLASSES"
  959. }
  960. ],
  961. "fingerprint": "0"
  962. },
  963. {
  964. "accountId": "7155460",
  965. "containerId": "1385556",
  966. "variableId": "49",
  967. "name": "element id",
  968. "type": "aev",
  969. "parameter": [
  970. {
  971. "type": "TEMPLATE",
  972. "key": "varType",
  973. "value": "ID"
  974. }
  975. ],
  976. "fingerprint": "0"
  977. },
  978. {
  979. "accountId": "7155460",
  980. "containerId": "1385556",
  981. "variableId": "50",
  982. "name": "element target",
  983. "type": "aev",
  984. "parameter": [
  985. {
  986. "type": "TEMPLATE",
  987. "key": "varType",
  988. "value": "TARGET"
  989. }
  990. ],
  991. "fingerprint": "0"
  992. },
  993. {
  994. "accountId": "7155460",
  995. "containerId": "1385556",
  996. "variableId": "51",
  997. "name": "element text",
  998. "type": "aev",
  999. "parameter": [
  1000. {
  1001. "type": "TEMPLATE",
  1002. "key": "varType",
  1003. "value": "TEXT"
  1004. }
  1005. ],
  1006. "fingerprint": "0"
  1007. },
  1008. {
  1009. "accountId": "7155460",
  1010. "containerId": "1385556",
  1011. "variableId": "36",
  1012. "name": "element url",
  1013. "type": "aev",
  1014. "parameter": [
  1015. {
  1016. "type": "TEMPLATE",
  1017. "key": "varType",
  1018. "value": "URL"
  1019. }
  1020. ],
  1021. "fingerprint": "0"
  1022. },
  1023. {
  1024. "accountId": "7155460",
  1025. "containerId": "1385556",
  1026. "variableId": "52",
  1027. "name": "event",
  1028. "type": "e",
  1029. "fingerprint": "0"
  1030. },
  1031. {
  1032. "accountId": "7155460",
  1033. "containerId": "1385556",
  1034. "variableId": "53",
  1035. "name": "history change source",
  1036. "type": "aev",
  1037. "parameter": [
  1038. {
  1039. "type": "TEMPLATE",
  1040. "key": "varType",
  1041. "value": "HISTORY_CHANGE_SOURCE"
  1042. }
  1043. ],
  1044. "fingerprint": "0"
  1045. },
  1046. {
  1047. "accountId": "7155460",
  1048. "containerId": "1385556",
  1049. "variableId": "54",
  1050. "name": "history new state",
  1051. "type": "aev",
  1052. "parameter": [
  1053. {
  1054. "type": "TEMPLATE",
  1055. "key": "varType",
  1056. "value": "HISTORY_NEW_STATE"
  1057. }
  1058. ],
  1059. "fingerprint": "0"
  1060. },
  1061. {
  1062. "accountId": "7155460",
  1063. "containerId": "1385556",
  1064. "variableId": "55",
  1065. "name": "history new url fragment",
  1066. "type": "aev",
  1067. "parameter": [
  1068. {
  1069. "type": "TEMPLATE",
  1070. "key": "varType",
  1071. "value": "HISTORY_NEW_URL_FRAGMENT"
  1072. }
  1073. ],
  1074. "fingerprint": "0"
  1075. },
  1076. {
  1077. "accountId": "7155460",
  1078. "containerId": "1385556",
  1079. "variableId": "56",
  1080. "name": "history old state",
  1081. "type": "aev",
  1082. "parameter": [
  1083. {
  1084. "type": "TEMPLATE",
  1085. "key": "varType",
  1086. "value": "HISTORY_OLD_STATE"
  1087. }
  1088. ],
  1089. "fingerprint": "0"
  1090. },
  1091. {
  1092. "accountId": "7155460",
  1093. "containerId": "1385556",
  1094. "variableId": "57",
  1095. "name": "history old url fragment",
  1096. "type": "aev",
  1097. "parameter": [
  1098. {
  1099. "type": "TEMPLATE",
  1100. "key": "varType",
  1101. "value": "HISTORY_OLD_URL_FRAGMENT"
  1102. }
  1103. ],
  1104. "fingerprint": "0"
  1105. },
  1106. {
  1107. "accountId": "7155460",
  1108. "containerId": "1385556",
  1109. "variableId": "59",
  1110. "name": "referrer",
  1111. "type": "f",
  1112. "fingerprint": "0"
  1113. },
  1114. {
  1115. "accountId": "7155460",
  1116. "containerId": "1385556",
  1117. "variableId": "31",
  1118. "name": "url",
  1119. "type": "u",
  1120. "parameter": [
  1121. {
  1122. "type": "TEMPLATE",
  1123. "key": "component",
  1124. "value": "URL"
  1125. }
  1126. ],
  1127. "fingerprint": "0"
  1128. },
  1129. {
  1130. "accountId": "7155460",
  1131. "containerId": "1385556",
  1132. "variableId": "33",
  1133. "name": "url fragment",
  1134. "type": "u",
  1135. "parameter": [
  1136. {
  1137. "type": "TEMPLATE",
  1138. "key": "component",
  1139. "value": "FRAGMENT"
  1140. }
  1141. ],
  1142. "fingerprint": "0"
  1143. },
  1144. {
  1145. "accountId": "7155460",
  1146. "containerId": "1385556",
  1147. "variableId": "60",
  1148. "name": "url hostname",
  1149. "type": "u",
  1150. "parameter": [
  1151. {
  1152. "type": "TEMPLATE",
  1153. "key": "component",
  1154. "value": "HOST"
  1155. }
  1156. ],
  1157. "fingerprint": "0"
  1158. },
  1159. {
  1160. "accountId": "7155460",
  1161. "containerId": "1385556",
  1162. "variableId": "32",
  1163. "name": "url path",
  1164. "type": "u",
  1165. "parameter": [
  1166. {
  1167. "type": "TEMPLATE",
  1168. "key": "component",
  1169. "value": "PATH"
  1170. }
  1171. ],
  1172. "fingerprint": "0"
  1173. }
  1174. ]
  1175. }
  1176. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement