In general auto-event modules and customHTML modules for Youtube, Facebook, Twitter and ScrollTracking modules should be enabled via GTM constant string macros and conditional rules – it should not set within the page.

 

// GTM settings: onpage auto-event overrides

“settings_gtm_isAutoEvent_pageErrorTrackingEnabled”       : “true”, // gtm.pageError for JS error tracking

“settings_gtm_isAutoEvent_historyChangeTrackingEnabled”: “true”, // gtm.historyChange for AJAX tracking

“settings_gtm_isAutoEvent_linkClickTrackingEnabled”       : “true”, // gtm.linkClick for OutboundLink Tracking

“settings_gtm_isAutoEvent_clickTrackingEnabled”           : “false”, // gtm.click

“settings_gtm_isAutoEvent_timerTrackingEnabled”           : “false”, // gtm.timer for heartbeats

“settings_gtm_isAutoEvent_formSubmitTrackingEnabled”: “false”, // gtm.formSubmit – default 2sec delay

 

// GTM settings: onpage customHTML overrides

“settings_gtm_isScrollTrackingEnabled”        : “false”, // Blog content pages customHTML script

“settings_gtm_isYoutubeTrackingEnabled”       : “false”, // Youtube API auto-tracking customHTML script

“settings_gtm_isFacebookAndTwitterButtonTrackingEnabled”: “false”, //Auto-social button tracking

 

// GEO-ip mapping and Browsers DNT response

“session_geoIpStatus”             : geoplugin_status, // 403 error, 200 is lookup ok

“session_geoIpCountryCode”                    : geoplugin_countryCode, // geoplugin JS variable

“session_geoIpContinentCode”                  : geoplugin_continentCode, // geoplugin JS variable

“session_geoIpIsCookieConsentRequired”        : geop1ugin_cookieConsent, // JS variable

“session_preferenceForDnt”                    : window.navigator.doNotTrack,// 1|0|”not-set” JS dom function

 

Similarly, these settings should be configured within GTM constant string macros and lookup tables – it should not set within the page.

 

// GA settings: onpage customHTML settings

“settings_ga_id”: “UA-00000-1“, // UA-00000-2 DEV, UA-00000-1 on LIVE

“settings_ga_setDomainName”: “clientdomain.com“, // “auto” or “none” or “clientdomain.com”

“settings_gtm_debugMode”: false, // true or false

 

// Adwords settings

“google_conversion_id”            : “123456“,

“google_conversion_label”         : “other” // Enter Adwords label

//, “google_conversion_value”     : “250.00“, // same value as dataLayer.ecommerce.purchase.actionField.revenue

 

// GA settings: onpage customHTML settings

“settings_ga_externalCrossDomainlinksToDecorate”: “otherdomain1.com, mycart.com“, // Separate using comma

“settings_ga_listDownloadLinkTrackingFiles”: “pdf|doc|docx|xls|xlsx”, // Separate using | pipes

“settings_ga_isInPageLinkTrackingEnabled”: “true”, // Improves accuracy of internal Link tracking

“settings_ga_isHashUrlFragmentsTrackingEnabled”: “false”, //Append location.hash pageVirtual#url

 

The only exception to this the gtm.blacklist failsafe switch, that needs to be inline:

 

// “gtm.blacklist”: [“customScripts”], // Uncomment to disable custom JS for debugging purposes

 

<!– Existing dataLayer – used to turn ServerSide variables into JS –>

<script>

// window.isLoggedIn = “true”;

</script>

 

<!– GeoIP to country dataLayer variables – WARNING non-ssl script –>

<script src=”http://www.geoplugin.net/javascript.gp?ver=3.5.1″ type=”text/javascript”></script>

<script src=”http://www.geoplugin.net/extras/cookielaw.js” type=”text/javascript”></script>

<script>window.dataLayer = window.dataLayer || [];

dataLayer.push({‘event’: ‘header_geoplugin_loaded’});

</script>

 

<!– jQuery 1.11.1 loaded via Google CDN –>

<script src=”//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js”></script>

<script>window.jQuery || document.write(“<script src=’//ClientDomain.com/js/common/jquery/jquery-1.11.1.min.js’></script>”);</script><script>jQuery.noConflict();</script>

<script src=”//code.jquery.com/jquery-migrate-1.2.1.min.js”></script>

<script>window.dataLayer = window.dataLayer || [];

dataLayer.push({‘event’: ‘header_jquery_loaded’});

</script>

 

<!– Google Tag Manager dataLayer for global header –>

<script>

window.dataLayer = window.dataLayer || [];

dataLayer.push({

// Global settings

“version”            : “1.0”, // W3C digital dataLayer version

“environmentIdentifier”           : “dev“, // dev, staging or live

“pageBrandName”                  : “big brand”, // If using multiple brands in rollup then use this field

“pageLanguage”                    : “en”, // locale-code for page language e.g. en

“pageCountry”                    : “us”, // Use 2character ISO Country list e.g. us

“pageGeoRegion”                  : “new york”, // Only needed for large localised websites

 

// Page values

“pageVirtual”                     : “”, // e.g. “/virtual” + location.pathname + location.search

“pageAttributesSysEnv”            : “desktop”, // Responsive CSS = desktop | tablet | mobile.

“pageHttpResponseCode”            : “<?php http_response_code(); ?>”, // e.g 200 or 404 or 500

“page.id”            : “1234”,

“pageSiteSearchResults”           : “”, // 0 means 0 results returned

//”pageGroup1_manualClassification”: “”, // reserved slot for manual names

“pageGroup2_category” : “”, // pageCategory

“pageGroup3_subCategory”          : “”, // pageSubcategory, pagePostType or paymentStep

“pageGroup4_templateName”         : “”, // pageTemplateName, pageBreadcrumb or pagePostAuthor

//”pageGroup5_containerVersion”: “”, // reserved slot for {{autoContainerVersion}}

“pageContentCreated” : “”, // 2013-01-01 server-side variable

“pageContentModified” : “”, // 2013-01-01 server-side variable

“pageForumPosts”                  : “”, // e.g. 25

// Note: these are the dataLayer names output by Duracell Tomi WordPress plugin: pageCategory,pagePostType,pagePostType2,pagePostAuthor,visitorLoginState,visitorType,inputClass,inputName

 

// Visitors preference and Safari view mode

“user_authIsUserIdToSessionIdOverrideEnabled”: “false”, // true|false is set on Login or Register complete page. userIDoveride MUST default to false. Only change if consent gained or DNT=0

“session_xPreview”: “<?php if ($_SERVER[‘HTTP_X_PURPOSE’] == ‘preview’ {‘preview’} else {”} ?>”, // Safari loading page in preview mode

 

// Ecommerce payment page variables

“ecommerce”: {

“currencyCode”                    : “”, // LOCAL currency profile

“purchase”: { // promo_click > detail > add | remove > checkout | checkout_option >>> purchase | refund

“actionField”: {

“step”                      : “”, // 1-6

“option”                    : “”, // checkout > login > delivery > billing > payments > complete

“id”                        : “”,

“affiliation”  : “”, // optional

“revenue”                   : “”, // 120*1quantity + 120*1quantity + 10shipping

“tax”                       : “”, // 250 * (1-(100%/120%))

“shipping”                  : “”, // Includes Tax: 8.33 + tax = 10.00

“shippingMethod”            : “”, // optional

“date”                      : “”, // optional

“coupon”                    : “”, // optional – aka transactionPromoCode or transactionVoucher

“couponDiscount”            : “”, // optional – how much reduced by, not percentage

“paymentType”  : “”, // optional – can also be used for CreditCard, Paypal, etc

“type”                      : “”, // optional

“subTotalIncludeTax”        : “” // Indicates whether TransactionTotal includes tax

},

“products”: [

{“id”:””, “name”:””, “category”:””, “brand”:””, “variant”:””, “coupon”:””, “price”:””, “quantity”:””},

{“id”:””, “name”:””, “category”:””, “brand”:””, “variant”:””, “coupon”:””, “price”:””, “quantity”:””}

]

}

},

// CustomDimensions persistence can be userScope=6months, sessionScope=30mins or hitScope=pageScope

“user.id”            : “”, // cd001: userScope -auth.user.getId

“cart.id”            : “”, // cd014: sessionScope

//, “containerVersion”            : “”, // cd005: reserved slot for userScope {{containerVersion}}

// CustomMetrics type can be integerType, currencyType (decimals), timeType

“cart.total”                      : “”, // cm002: currencyType – ecomm_totalvalue

“visitorLifetimeValue”: “”, // cm001: currencyType – Includes Tax: ($100*2+$10)+tax = $250.00

“firstPurchaseDate”: new Date(“January 01 2014 23:59:59”), // cd007: userScope customer lifetime

 

// Adwords Dynamic Remarketing dimensions for product image IDs

// support.google.com/adwords/answer/2476691?hl=en & support.google.com/adwords/answer/3103357?hl=en

// & support.google.com/tagmanager/answer/3002580?hl=en

“google_tag_params”: {

“ecomm_pagetype”: “purchase”,//cd015:home|category|product|cart|purchase|other {{page.category.pageType}}

“ecomm_paymentstep”: dataLayer.ecommerce.purchase.actionField.option,//cd016: cart|login|delivery|billing|payments|complete

“ecomm_prodid”                    : [“”], // cd017: e.g. [“sku_111″,”sku_222”] {{ecommerce.products[n].id}}

“ecomm_totalvalue”         : dataLayer.ecommerce.purchase.actionField.revenue, // cm002: £100

“ecomm_pname”                     : [“”], // cd018: optional {{ecommerce.products[n].name}}

“ecomm_pcat”                      : [“”], // cd019: optional {{ecommerce.products[n].category}}

“ecomm_rec_prodid”         : [“”], // cd020: e.g. shoe shine {{ecommerce.recommendation[n].id}}

// Auth logged-in variables

//”user.id”                : “”, // cd001:WARNING never use userId, cartId or sessionId for remarketing

“user_isRegistered”        : “”, // cd002: y|n users has an account?

“user_isLoggedIn”          : “”, // cd003: y|n users is signed-in?

“user_isReturnCustomer”           : “”, // cd004: y|n users has transacted already?

“user_memberType”          : “”, // cd006: Free Member, Premium Member or Enterprise Member

“user_memberTypeClass”            : “”, // cd007: sub-types of memberClass

“user_ageRange”                   : “”, // cd008: Age range

“user_gender”                     : “”, // cd009: Gender

“user_customerQualityScore”       : “”, // cd010: Customer Quality Score – High, Med, Low

“user_highSpenderScore”           : “”, // cd011: High Spender Score – High, Med, Low

“user_loyaltyScore”        : “”, // cd012: Loyalty Score – High, Med, Low

“session_testVariant”             : “” // cd013: combine A/B testing offer with remarketing

//, “session_type”         : “”, // cd000: new|returning 30min session native GA field UserType },

},

“event”: “header_datalayer_loaded” // Used to trigger dataLayer dependencies

//, event” : “transaction” // Trigger transaction submission to GA via GTM

});

// interoperability with legacy Adwords google_tag_params

window.google_tag_params = window.google_tag_params || [];

google_tag_params.push({“google_tag_params”: window.dataLayer});

</script>

<!– End Google Tag Manager Data Layer –>

</HEAD>

<BODY>

<!– Google Tag Manager –>

<noscript><iframe src=”//www.googletagmanager.com/ns.html?id=GTM-xxxx” height=”0″ width=”0″ style=”display:none;visibility:hidden”></iframe></noscript>

<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({‘gtm.start’:

new Date().getTime(),event:’gtm.js’});var f=d.getElementsByTagName(s)[0],

j=d.createElement(s),dl=l!=’dataLayer’?’&l=’+l:”;j.async=true;j.src=

‘//www.googletagmanager.com/gtm.js?id=’+i+dl;f.parentNode.insertBefore(j,f);

})(window,document,’script’,’dataLayer’,’GTM-xxxx’);

</script>

<!– VERSION: GTM_October_v1 –>

<!– WEBSITE: clientdomain.com –>

<!– CATEGORY: ecommerce –>

<!– MARKET: UK –>

<!– GTM-LIVE:UA-00000-1 | GTM-DEV:UA-00000-2 :: rolledupTracker     –>

<!– GTM-LIVE:UA-111111-1 | GTM-DEV:UA-111111-2 :: localCountryTracker –>

<!– Replace GTM-xxxx with GTM-LIVE for live, or GTM-DEV for dev –>

<!– End Google Tag Manager –>

 

0117 3361103