Purchase Event Rule

Avatar

Avatar
Validate 10
Level 1
bindukumari1990
Level 1

Like

1 like

Total Posts

69 posts

Correct reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 1
View profile

Avatar
Validate 10
Level 1
bindukumari1990
Level 1

Like

1 like

Total Posts

69 posts

Correct reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 1
View profile
bindukumari1990
Level 1

11-07-2021

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:

 

bindukumari1990_0-1625994339717.png

bindukumari1990_1-1625994387186.png

So, please let know the reason for the same.

 

Thanks!!

 

 

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Boost 25
Level 4
amgup
Level 4

Likes

33 likes

Total Posts

133 posts

Correct reply

20 solutions
Top badges earned
Boost 25
Affirm 10
Boost 5
Boost 3
Boost 10
View profile

Avatar
Boost 25
Level 4
amgup
Level 4

Likes

33 likes

Total Posts

133 posts

Correct reply

20 solutions
Top badges earned
Boost 25
Affirm 10
Boost 5
Boost 3
Boost 10
View profile
amgup
Level 4

11-07-2021

@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

@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?

amgup
Can you share the screenshot of products syntax you have set in your code ?
bindukumari1990

@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];
}
}*/

amgup
There seems to be some syntax related issue. I will suggest you to breakdown this syntax in simple terms. Also remove the '+' after the s.products.

Answers (0)