Expand my Community achievements bar.

Handling Adobe Target Custom code handle incase of conflict

Avatar

Level 2

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?

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Reply

Avatar

Level 6

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:

Option 1: Update Audience Conditions

You can adjust the audience criteria to ensure that only one activity is displayed when a user qualifies for both audiences:

  • Audience 1: Users who meet the criteria for Audience 1 will see Activity 1.
  • Audience 2: Users who qualify for Audience 2 but not Audience 1 will see Activity 2 (i.e., exclude Audience 1 from Audience 2).

This ensures that Audience 1 takes precedence, and users who belong to both audiences will only see Activity 1.

Option 2: Implement Checks in Custom Code

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