I have created purchase event rule by using direct call identifier, but here I am facing issue regarding setting variables i.e. event is firing but product variable is not setting. Please see the screenshot for the same:
So, please let know the reason for the same.
Thanks!!
Solved! Go to Solution.
Views
Replies
Total Likes
@bindukumari1990 If this is an s.tl() call than s.products needs to be passed in s.linkTrackVars as per the given below document in the custom code editor in Launch rule :-
https://experienceleague.adobe.com/docs/analytics/implementation/vars/config-vars/linktrackvars.html...
@bindukumari1990 If this is an s.tl() call than s.products needs to be passed in s.linkTrackVars as per the given below document in the custom code editor in Launch rule :-
https://experienceleague.adobe.com/docs/analytics/implementation/vars/config-vars/linktrackvars.html...
@amgup, Okay I have added, but without s.tl() call, direct call identifier is triggered, even I can see rule is firing in the dtm switch extension, but still variables are not setting. Any specific reason?
Views
Replies
Total Likes
Views
Replies
Total Likes
@amgup, Please find the code below:
s.products = "";
s.eVar14 = "";
//s.eVar17 = "";
for(var i=0; i<window.shopti_data_layer.products.length; i++) {
//
s.linkTrackVars = "eVar10,eVar12,eVar14,eVar15,eVar16,eVar17,products";
//s.eVar14 = window.shopti_data_layer.products[i].product_id ;
s.eVar10 = window.shopti_data_layer.cart_total;
s.eVar12 = window.shopti_data_layer.total_products;
s.products += window.shopti_data_layer.products[i].product_category + ";" + window.shopti_data_layer.products[i].name.replace(/,/g, "") + ";" + window.shopti_data_layer.product_qty[i] + ";" + window.shopti_data_layer.product_qty[i] * window.shopti_data_layer.product_prices[i] + ";" + ";" + "eVar14=" + window.shopti_data_layer.products[i].product_id + "|" + "eVar16=" + window.shopti_data_layer.products[i].product_category + "|" + "eVar17=" + window.shopti_data_layer.products[i].product_sub_category;
if(i != window.shopti_data_layer.products.length-1) {
s.products += ",";
}
}
s.eVar10 ="";
s.eVar12 ="";
s.eVar14 = "";
s.eVar15 = "";
//s.eVar16 = "";
//s.eVar17 = "";
for(var i=0; i<window.shopti_data_layer.products.length; i++) {
//s.eVar14 += window.shopti_data_layer.products[i].product_id ;
//s.eVar15 += window.shopti_data_layer.products[i].name.replace(/,/g, "") ;
s.eVar10 = window.shopti_data_layer.cart_total;
s.eVar12 = window.shopti_data_layer.total_products;
//s.eVar16 += window.shopti_data_layer.products[i].product_category ;
//s.eVar17 += window.shopti_data_layer.products[i].product_sub_category;
if(i != window.shopti_data_layer.products.length-1) {
// s.eVar14 += ",";
//s.eVar15 += ",";
//s.eVar16 += ",";
//s.eVar17 += ",";
}
}
/*var input = s.products;
var fields = input.split(';');
for(var j =0; j< fields.length;j++){
if(fields[j] != 'undefinedundefined' || fields[j] != 'undefined'){
s.products += fields[j];
}
}*/
Views
Replies
Total Likes
Views
Replies
Total Likes