Expand my Community achievements bar.

SOLVED

Query related to Cart abandonment experience targeting

Avatar

Level 3

Hi all
I was intended to create a cart abandonment experience target activity
--- where the cart items stored in local storage
--- I got the count of items in cart by above 
--- in activity default experience for all visitors
--- target segment(user who has cart items more than 3) added custom code in modification tab
-- while assigning audience iam stuck what should i have to do so that i get the audience who qualified for the activity
here is the custom code {

window.targetPageParams = function() {
let cart = JSON.parse(localStorage.getItem("cart") || "[]");
let cartItemCount = cart.length;

return {
"cartItemCount": cartItemCount
};
};

 }
@kandersen 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @sriharshanaladala98   Were you able to solve this issue? 

 

As you're passing custom parameter called "cartItemCount" through custom code so just check once that the parameter is getting passed correctly in your Target call. 

 

To check this open your browser dev tools, go to network tab and search for "delivery" (if you're using at.js implementation of adobe target)  or search for "interact" call ( if you're using websdk approach, Notice that decisionScopes has a value of __view__ . This scope is the equivalent to the target-global-mbox

 

in the request payload - check like below 

"parameters": {
      "cartItemCount": 4
}

If this is correct then you can use this for audience, 

Go to audience - chose Custom -> Custom Rule->   add like  cartItemCount > 3  

 

This way you can setup audience. However in case if you're looking for to persist this cartItemCount value across session then you can use profile parameter. 

Modify your code like below 

window.targetPageParams = function() {
let cart = JSON.parse(localStorage.getItem("cart") || "[]");
let cartItemCount = cart.length;

return {
"profile.cartItemCount": cartItemCount
};
};

 Then for to set up audience,  chose Visitor Profile and use cartItemCount > 3 

 

Hope this helps. If you've any more question please feel free to post here. 

Thanks,

View solution in original post

4 Replies

Avatar

Correct answer by
Community Advisor

Hi @sriharshanaladala98   Were you able to solve this issue? 

 

As you're passing custom parameter called "cartItemCount" through custom code so just check once that the parameter is getting passed correctly in your Target call. 

 

To check this open your browser dev tools, go to network tab and search for "delivery" (if you're using at.js implementation of adobe target)  or search for "interact" call ( if you're using websdk approach, Notice that decisionScopes has a value of __view__ . This scope is the equivalent to the target-global-mbox

 

in the request payload - check like below 

"parameters": {
      "cartItemCount": 4
}

If this is correct then you can use this for audience, 

Go to audience - chose Custom -> Custom Rule->   add like  cartItemCount > 3  

 

This way you can setup audience. However in case if you're looking for to persist this cartItemCount value across session then you can use profile parameter. 

Modify your code like below 

window.targetPageParams = function() {
let cart = JSON.parse(localStorage.getItem("cart") || "[]");
let cartItemCount = cart.length;

return {
"profile.cartItemCount": cartItemCount
};
};

 Then for to set up audience,  chose Visitor Profile and use cartItemCount > 3 

 

Hope this helps. If you've any more question please feel free to post here. 

Thanks,

where do i need to write this modified code? in custom code on right side bar ?

 

Avatar

Community Advisor

Hi @sriharshanaladala98 

Depending on which test type you chose, if you're using Visual Experience Composer (VEC)  test then you've a option like below. 

In the modification panel, you can add as custom code 

 

Gokul_Agiwal_0-1746607830887.png

another way, If you're using Adobe Launch (Adobe data collection / Adobe Tags) then you can add your custom code there. 

Hope it helps. 

 

 

i will try and let you know the progress