Hey everyone,
I need some advice on the best way to handle the following scenario:
We have an XT activity with 2 VEC where we've added custom code to append the banners dynamically.
Activity 1 -> Audience 1 -> custom code 1
Activity 2 -> Audience 2 -> custom code 2
Some users are eligible for both audiences, so both activities are getting resolved, resulting in both custom codes being loaded, creating an unwanted UI. Setting priority in activities is not helping in the case of custom code.
Is there any way we can control which script gets executed from the target settings?
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Hi @aem_2718 ,
To address this issue, you can incorporate checks and updates either within your audience segmentation or custom code to control which script executes based on user eligibility and prioritisation of the activities.
For example, consider two activities Activity 1 and Activity 2 targeting two separate audiences, Audience 1 and Audience 2, respectively. In a scenario where a user qualifies for both audiences, and you want only Activity 1 to be shown, you can manage this through several approaches:
You can adjust the audience criteria to ensure that only one activity is displayed when a user qualifies for both audiences:
This ensures that Audience 1 takes precedence, and users who belong to both audiences will only see Activity 1.
Alternatively, you can add checks within the custom code to manage the execution of scripts. A global variable or flag can be defined to indicate when one audience’s script has already been executed. The second script will check this flag before running and will not execute if the first script has already triggered.
By using either of these methods, you can effectively control which experience is shown and prevent the unintended execution of multiple custom codes.
Best Regards,
Vaibhav Mathur
Hi @aem_2718 ,
To address this issue, you can incorporate checks and updates either within your audience segmentation or custom code to control which script executes based on user eligibility and prioritisation of the activities.
For example, consider two activities Activity 1 and Activity 2 targeting two separate audiences, Audience 1 and Audience 2, respectively. In a scenario where a user qualifies for both audiences, and you want only Activity 1 to be shown, you can manage this through several approaches:
You can adjust the audience criteria to ensure that only one activity is displayed when a user qualifies for both audiences:
This ensures that Audience 1 takes precedence, and users who belong to both audiences will only see Activity 1.
Alternatively, you can add checks within the custom code to manage the execution of scripts. A global variable or flag can be defined to indicate when one audience’s script has already been executed. The second script will check this flag before running and will not execute if the first script has already triggered.
By using either of these methods, you can effectively control which experience is shown and prevent the unintended execution of multiple custom codes.
Best Regards,
Vaibhav Mathur
Views
Like
Replies
Views
Likes
Replies