Example script – product items and component widgets require array mapping.

<script>

window.digitalData = window.digitalData || [];

digtialData.push({

version: “1.0.1”,

pageInstanceID: dataLayer.environmentIdentifier, // e.g. “production”

 

// Adwords Dynamic Variables for cart

//cart.cartID                         : dataLayer.ecommerce.add.actionField.id, // “999999”

cart.price.cartTotal                  : dataLayer.google_tag_params.ecomm_totalvalue, // 125

product.productInfo.productID         : dataLayer.google_tag_params.ecomm_prodid, // [“SLR_3000”]

product.productInfo.productName       : dataLayer.google_tag_params.ecomm_pname, // [“Nikon SLR5”]

page.category.pageType                : dataLayer.google_tag_params.ecomm_pagetype, // [“cart”]

product.productInfo.manufacturer      : dataLayer.google_tag_params.ecomm_brand,      // “nikon”

product.category.primaryCategory      : dataLayer.google_tag_params.ecomm_pcat,       // [“cameras”]

product.category.subCategory1         : dataLayer.google_tag_params.ecomm_psubcat, // [“SLR”]

cart.attributes.recomendation.productID: dataLayer.google_tag_params.ecomm_rec_prodid,// [“SLR_xx”]

 

page.pageInfo.pageID                  : dataLayer.page.id, // “p1234”

page.pageInfo.pageName                : dataLayer.pageTitle, // “rogaine hair regrowth treatment”

page.pageInfo.sysEnv                  : dataLayer.pageAttributesSysEnv, // “mobile”

page.pageInfo.destinationURL : dataLayer.pageVirtual,              // “mysite.com/index.html”

page.pageInfo.referringURL   : dataLayer.pageReferral, // “www.google.com/url?q=&esrc=s”

page.pageInfo.onsiteSearchTerm        : dataLayer.pageSiteSearchTerm,       // “keyword”

page.pageInfo.onsiteSearchResult      : dataLayer.pageSiteSearchResults, // 10

page.pageInfo.language                : dataLayer.pageLanguage,    // “en”

page.pageinfo.country                 : dataLayer.pageCountry,               // “us”

page.pageInfo.geoRegion               : dataLayer.pageGeoRegion,   // “us”

page.pageInfo.issueDate               : dataLayer.pageContentCreated,       // “2013-09-01”

page.pageInfo.effectiveDate  : dataLayer.pageContentModified,      // “2013-09-20”

page.attributes.numberOfComments      : dataLayer.pageForumPosts, // “5”

page.category.primaryCategory         : dataLayer.pageGroup1_category,      // “faq pages”

page.category.subCategory1   : dataLayer.pageGroup2_subCategory, // “productinfo”

//page.category.pageType              : dataLayer.pageGroup3_templateName, // “faq”

page.attributes.funnelStep   : dataLayer.pageGroup4_funnelStep, // “3990”

page.pageInfo.author                  : dataLayer.pageGroup5_author,        // “j smith”

 

transaction.transactionID             : dataLayer.ecommerce.purchase.actionField.id, // “999999”

transaction.total.currency   : dataLayer.ecommerce.currencyCode, // “EUR”

transaction.total.voucherCode         : dataLayer.ecommerce.purchase.actionField.coupon,// “alpha”

//transaction.total.taxRate  : dataLayer.ecommerce.purchase.actionField.tax, // 0.20

transaction.total.shipping   : dataLayer.ecommerce.purchase.actionField.shipping, // 5

transaction.total.shippingMethod      : dataLayer.ecommerce.purchase.actionField.shippingMethod,//”ups”

transaction.total.transactionTotal: dataLayer.ecommerce.purchase.actionField.revenue, // 125

transaction.attributes.paymentMethod: dataLayer.ecommerce.purchase.actionField.PaymentMethod,//card

 

transaction.item[0].productInfo.productID: dataLayer.ecommerce.products[0].id, // “123”

transaction.item[0].productInfo.productName: dataLayer.ecommerce.products[0].name,// blue shoes

transaction.item[0].category : dataLayer.ecommerce.products[0].category, // “shoes”

transaction.item[0].price             : dataLayer.ecommerce.products[0].price,        // 100

transaction.item[0].quantity : dataLayer.ecommerce.products[0].quantity, // 1

 

transaction.profile.address.city      : dataLayer.ecommerce.purchase.actionField.city, // “austin”

transaction.profile.address.stateProvince: dataLayer.ecommerce.purchase.actionField.region, // “tx”

transaction.profile.address.country: dataLayer.ecommerce.purchase.actionField.country, // “usa”

 

user.profile.profileInfo.profileID    : dataLayer.user.id, // “user12345”

user.segment.isNewRegistration        : dataLayer.google_tag_params.isNewRegistration, // “true”

user.segment.isUserNewCustomer        : dataLayer.google_tag_params.isUserNewCustomer, // “true”

user.segment.isLoggedIn               : dataLayer.google_tag_params.isLoggedIn,       // “true”

user.segment.customerClassDimension: dataLayer.google_tag_params.memberType, // “platinum member”

user.segment.visitorLifetimeValue: dataLayer.visitorLifetimeValue, // 100

 

event.eventInfo.eventName             : dataLayer.event,           // “add news portal”

event.category.primaryCategory        : dataLayer.eventCategory,   // “portal”

event.eventInfo.eventAction  : dataLayer.eventAction,              // “addportal”

event.eventInfo.type                  : dataLayer.eventLabel,               // “contentmodifier”

event.eventInfo.eventPoints  : dataLayer.eventValue,               // 200

event.attributes.nonInteractive       : dataLayer.eventNonInteractive,      // false

 

component[0].componentInfo.componentID : dataLayer.event, // “rog300v”

component[0].category.primaryCategory : dataLayer.eventCategory, // “haircare”

component[0].category.componentType   : dataLayer.eventAction,     // “flash movie”

component[0].componentInfo.description : dataLayer.eventLabel,      // “hair treatment video”

component[0].attributes.eventPoints   : dataLayer.eventValue,

component[0].attributes.nonInteractive : dataLayer.eventNonInteractive // false

});

</script>

FREE GOOGLE TAG MANAGER BOOK

For the PDF Copy, please enter email address
DOWNLOAD
Click Me
0117 3361103

FREE GOOGLE TAG MANAGER BOOK

For the PDF Copy, please enter email address
DOWNLOAD
close-link
Click Me