1.8K members online now
1.8K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
Guide Me

Custom dimensions and metrics on product view

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

I want to use a product custom dimension (and metric) in a product view, is that actually possible?  Do product detail views work with custom dimensions?  I have the below (in GTM) and although product views are being tracked the custom dimensions and metrics don't seem to come through


function productpageload(){

hc_product_isbn = hcDatalayer.productListing[0].isbn;
hc_component_name = 'product-page';
found_json = getjsonvalues(hc_product_isbn, hc_component_name);
name = found_json["name"];
id = found_json["id"];
position = found_json["position"];
price = found_json["price"];
brand = found_json["brand"];
list = found_json["list"];
variant = found_json["variant"];
category = found_json["category"];

metric1 = "1.99";
dimension4 = "preorder";

var DLecommerceData = {
'event': 'enhancedecommerce',
'ecommerce': {
'detail': {
'actionField': {'list': 'detail-page'}, // 'detail' actions have an optional list property.
'products': []
DLecommerceData.ecommerce.detail.products.push({id: id, name: name, price: price, brand: brand, list: list, variant: variant, category: category, metric1: metric1, dimension4: dimension4});






The console says this, so it looks to me everything is coming through correctly


ecSmiley Tongueroduct "1" dimension "4" (&pr1cd4) preorder
ecSmiley Tongueroduct "1" metric "1" (&pr1cm1) 1.99


I have have them set as scope=product


Anyone have any experience of this?





Re: Custom dimensions and metrics on product view

Visitor ✭ ✭ ✭
# 2
Visitor ✭ ✭ ✭
I am going to reply to myself. This does actually work, I think maybe I was being a bit impatient



Custom dimensions and metrics on product view

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Hey Grant, Did your product scoped custom dimension work for product detail views or did you have to change this to be a hit level custom dimension for it to track against the product detail view?