Hi Team,
I am using s.product string to capture the product details. I am capturing the primary category in evar16 and 17. I am using the below code to capture the data:
So, now if multiple product is added in the cart, then multiple values in coming in the report, so can I resolve the issue through classification.
Solved! Go to Solution.
Views
Replies
Total Likes
Dear Bindu,
Sorry, Classification is not the solution for your use case.
Guess, rather than capturing the products in the syntax below
s.products = "Category1;Product1;;;;eVar14=Value1|eVar17=Value1,Category2;Product2;;;;eVar14=Value2|eVar17=Value2,Category3;Product3;;;;eVar14=Value3|eVar17=Value3,";
you are capturing it as
s.products = "Category1,Category2,Category3;Product1,Product2,Product3;;;;eVar14=Value1,Value2,Value3|eVar17=Value1,Value2,Value3";
So, you need to have a proper syntax on your product string and that will resolve your issue.
Thank You, Pratheep Arun Raj B | Xerago | Terryn Winter Analytics
PS: I have bolded few values so that you can understand the difference due to multiple products.
Views
Replies
Total Likes
I think your code is wrong.
You're resetting s.products with each item in your shopti_data_layer's products array. What you should be doing is to append each item to s.products.
So something like this:
s.products = "";
for (var i=0; i < window.shopti_data_layer.products.length; i++) {
var product = window.shopti_data_layer.products[i].category + ";" + [rest of the product's data and eVars to be tracked];
s.products = s.apl(s.products, product);
}
Views
Replies
Total Likes
Views
Replies
Total Likes
Views
Replies
Total Likes
Views
Replies
Total Likes
s.products = "";
s.eVar14 = "";
s.eVar17 = "";
for(var i=0; i<window.shopti_data_layer.products.length; i++) {
//
s.linkTrackVars = "eVar14,eVar15,eVar16,eVar17";
s.eVar14 = window.shopti_data_layer.products[i].product_id ;
s.eVar17 = window.shopti_data_layer.products[i].product_sub_category;
//s.eVar15 += window.shopti_data_layer.products[i].name ;
//s.eVar15 = window.shopti_data_layer.products[i].name ;
//s.eVar16 = window.shopti_data_layer.products[i].product_category ;
// Add individual produ ct info to the product string
//s.products += window.shopti_data_layer.products[i].product_category + ";" + window.shopti_data_layer.products[i].name + ";" + ";" + ";" + ";" +s.eVar14 ;
s.products += window.shopti_data_layer.products[i].product_category + ";" + window.shopti_data_layer.products[i].name.replace(/,/g, "") + ";" + ";" + ";" + ";" + "eVar14=" + s.eVar14 + "|" + "eVar17=" + s.eVar17;
if(i != window.shopti_data_layer.products.length-1) {
s.products += ",";
}
}
Hope it s fine.
Views
Replies
Total Likes
Views
Replies
Total Likes
Yes you can use classification to resolve this.
Views
Replies
Total Likes
Views
Replies
Total Likes
Dear Bindu,
Sorry, Classification is not the solution for your use case.
Guess, rather than capturing the products in the syntax below
s.products = "Category1;Product1;;;;eVar14=Value1|eVar17=Value1,Category2;Product2;;;;eVar14=Value2|eVar17=Value2,Category3;Product3;;;;eVar14=Value3|eVar17=Value3,";
you are capturing it as
s.products = "Category1,Category2,Category3;Product1,Product2,Product3;;;;eVar14=Value1,Value2,Value3|eVar17=Value1,Value2,Value3";
So, you need to have a proper syntax on your product string and that will resolve your issue.
Thank You, Pratheep Arun Raj B | Xerago | Terryn Winter Analytics
PS: I have bolded few values so that you can understand the difference due to multiple products.
Views
Replies
Total Likes
Views
Replies
Total Likes
Views
Replies
Total Likes
Dear Bindu, Quick gotcha. Can you change the variable declaration for s.eVar14 and s.eVar17 to something else?
From
s.eVar14 = window.shopti_data_layer.products[i].product_id ;
s.eVar17 = window.shopti_data_layer.products[i].product_sub_category;
To
var Var14 = window.shopti_data_layer.products[i].product_id ;
var Var17 = window.shopti_data_layer.products[i].product_sub_category;
And then the product string to
s.products += window.shopti_data_layer.products[i].product_category + ";" + window.shopti_data_layer.products[i].name.replace(/,/g, "") + ";" + ";" + ";" + ";" + "eVar14=" + Var14 + "|" + "eVar17=" + Var17;
Guess, s.eVar14 and s.eVar17 are set twice, once in global & another in merchandising and thus the issue. Just a thought!
Thank You, Pratheep Arun Raj B
Views
Replies
Total Likes
Views
Replies
Total Likes
Views
Replies
Total Likes
Views
Replies
Total Likes
Views
Replies
Total Likes
Views
Replies
Total Likes