This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var _customTask = function () { | |
// customTask Builder by Simo Ahava | |
// | |
// More information about customTask: https://www.simoahava.com/analytics/customtask-the-guide/ | |
// | |
// Change the default values for the settings below. | |
// clientIdIndex: The Custom Dimension index to where you want to send the visitor's Client ID. | |
// https://bit.ly/2Ms0ZcC | |
var clientIdIndex = 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="customTaskWrapper"> | |
<table> | |
<thead> | |
<tr> | |
<th>Click to select which feature(s) to include</th> | |
</tr> | |
</thead> | |
<tbody> | |
<tr> | |
<td data-customtask-id='cid' data-customtask-selected='false'>Client ID as a Custom Dimension</td> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
// Set the timeout for when the dataLayer history should be purged. The default is 30 minutes. | |
// The timeout needs to be in milliseconds. | |
var timeout = 30*60*1000; | |
// Change dataLayerName only if you've defined another named for the dataLayer array in your | |
// GTM container snippet. | |
var dataLayerName = 'dataLayer'; | |
// Don't change anything below. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright (c) 2013-2018 Snowplow Analytics Ltd. All rights reserved. | |
# | |
# This program is licensed to you under the Apache License Version 2.0, and | |
# you may not use this file except in compliance with the Apache License | |
# Version 2.0. You may obtain a copy of the Apache License Version 2.0 at | |
# http://www.apache.org/licenses/LICENSE-2.0. | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the Apache License Version 2.0 is distributed on an "AS | |
# IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var oldPush = window.dataLayer.push; | |
window.dataLayer.push = function() { | |
var states = [].slice.call(arguments, 0); | |
states.forEach(function(s) { | |
if (!s.hasOwnProperty('event')) { | |
s.event = 'default'; | |
} | |
}); | |
return oldPush.apply(window.dataLayer, states); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var checkLinker = function(str) { | |
// First browser fingerprint method. | |
// Uses the clientId / gid string, user agent, time, and browser plugin descriptions. | |
var joiner = function (cidGid, offset) { | |
var a = new Date, | |
b = window.navigator, | |
c = b.plugins || []; | |
var d = [cidGid, b.userAgent, a.getTimezoneOffset(), a.getYear(), a.getDate(), a.getHours(), a.getMinutes() + offset]; | |
for (var e = 0; e < c.length; ++e) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
___INFO___ | |
{ | |
"displayName": "Facebook Pixel", | |
"description": "This is a template prototype for the Facebook Pixel.", | |
"securityGroups": [], | |
"id": "cvt_temp_public_id", | |
"type": "TAG", | |
"version": 1, | |
"brand": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function() { | |
// Update this array with the class names | |
var classes = ['class1', 'class2', 'class3']; | |
// Fetch elements | |
var els = document.querySelectorAll('.' + classes.join(',.')) | |
return [].map.call(els, function(e) { | |
// Get first matching class name per element | |
return classes.filter(function(c) { | |
return e.className.indexOf(c) > -1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Call with decorateUrl('https://www.domain.com/url', 'UA-12345-1'); | |
// Outputs the URL string with the Universal Analytics cross-domain linker in place. | |
// Tracking ID is optional. If you leave it out, the linker will be built | |
// with the settings of the first tracker found on the page. | |
function decorateUrl(urlString, trackingId) { | |
var ga = window[window['GoogleAnalyticsObject']]; | |
if (ga && ga.getAll) { | |
var trackers = ga.getAll().filter(function(t) { | |
return trackingId ? t.get('trackingId') === trackingId : true; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Parse the IDs from the first four rows of the sheet | |
function getIds() { | |
const sheet = SpreadsheetApp.getActiveSheet(); | |
const ids = { | |
accountId: sheet.getRange('B1').getValue().toString(), | |
containerId: sheet.getRange('B2').getValue().toString(), | |
workspaceId: sheet.getRange('B3').getValue().toString(), | |
variableId: sheet.getRange('B4').getValue().toString() | |
}; | |
if (ids.workspaceId.toLowerCase() === 'default') ids.workspaceId = getDefaultWorkspaceId(ids.accountId, ids.containerId); |
OlderNewer