Expand my Community achievements bar.

SOLVED

Adobe Target Custom Code is running for hidden activity (Due to lower priority)

Avatar

Level 2

I have 2 separate XT activities with different audiences where I have added custom code (page load event) for the two activities. Both activities are applied on same location and have different priorities, But I see that even though the Activity/Experience is hidden because of priority still the page load event is added and getting fired.

  1. Is there a way to determine that XT/Experience is hidden or visible in profile scripts, so that I will increment the counter only when the experience is visible.
  2. Is there a way to not render the content of hidden activity when the activity is de-prioritized?
Topics

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

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Are you running both of these Activities on your global mbox/location? If so, the global location is configured to return ALL activities that you qualify for and order the return array in accordance with the priority levels. You will have to build custom handling for the "apply" portion of global location. 

 

I would recommend moving to a named mbox / location which is configured to only return ONE thing back to the browser, which should be the higher priority one. 

View solution in original post

7 Replies

Avatar

Level 3

Hi Suneel,

 

Can you elaborate more what you mean by Hidden activity? 

 

Can you confirm status either Inactive or Live?

 

Thanks

Karuppiah

Hello @Karuppiah_Sakthivel , Thanks for you reply.

I have two activities

  • Activity 1( Experience 1 with custom code block 1) with priority 900 - Audience1
  • Activity 2(Experience 2 with custom code block 2) with priority 500 - Audience2

Note: A user can belong to both the audience. 

Adobe Target evaluates the audience and based on the priority It displays Experience1. But, it also executes both the custom code blocks. Even when Experience 2 is hidden(due to lower priority) Custom code block 2 is executed. 
Custom code block 2 is added for frequency capping on how many times user have viewed an experience.

Hi Suneel,

 

There is no concept of hidden activities in AT. Whenever the activities is deprioritized it is still delivered and executed, only order of the execution changes.

 

For example: If you run two activities for same URL and same button

 

1. Activity 1: Changing the button name ( know more) -> Audience: All visitors -> Priority: 999

2.Activity 2: Changing the button name ( Learn More) -> Audience: India-> Priority: 0

 

Now, both activity will be executed but high priority (Activity1) will be the last one. So the all the visitors will view only the high priority Activity 1.

When you check in the delivery call in the preview itself it will show like below

 

Offer 0: Activity 2 ( Learn More)
Offer 1: Activity 1 ( Know More)

 

Kindly refer this URL https://experienceleague.adobe.com/en/docs/target/using/activities/priority 

Note: Please let me know the actual requirement, i will provide a solution.

Thanks
Karuppiah

Hello @Karuppiah_Sakthivel ,

Thanks for your reply.

 

Here is the custom code for each experience. The below event increments the view count of an activity's experience. We keep this count to implement Fatigue rule for an activity. Fatigue rule is implemented in the profile script. 

Custom code block #1 for Activity 1

 

<script>
 adobe.target.trackEvent({
    mbox: 'experience-experience_interaction',
    params: { 
      activityName_FatigueRule : 'frtest-p1', 
      activityId : ${activity.id},
      maxViews_FatigueRule: "2"
    } });
</script>

 

Custom code block #2 for activity 2

 

<script>
 adobe.target.trackEvent({
    mbox: 'experience-experience_interaction',
    params: { 
      activityName_FatigueRule : 'frtest-p2', 
      activityId : ${activity.id},
      maxViews_FatigueRule: "2"
    } });
</script>

 

 

Profile script:

 

if (mbox.name == 'experience-experience_interaction') {
  var listOfFatiguedActivities = user.get('FatiguedActivityList') || '';
  var activityName = mbox.param('activityName_FatigueRule');
  if (!activityName) {
    return listOfFatiguedActivities;
  }
  var viewsPerActivityKeyName = activityName + 'numberOfViewsFatigueRule';
  // if its an interactiion with your experience then increase the profile-script value by 1
  var numberOfViewsFatigueRule = parseInt(user.getLocal(viewsPerActivityKeyName)) || 0;
  var maxViewsForFatigueRule = parseInt(mbox.param('maxViews_FatigueRule') || 10); // retrieve parameters from mbox
  numberOfViewsFatigueRule = numberOfViewsFatigueRule + 1; // increment the view count
  
  user.setLocal(viewsPerActivityKeyName, numberOfViewsFatigueRule); //set the view count against the user profile  
  user.setLocal(activityName + 'maxViewsForFatigueRule', maxViewsForFatigueRule); //set the max views limit against user profile for reference
  
  if (numberOfViewsFatigueRule < maxViewsForFatigueRule) {
    return listOfFatiguedActivities;
  } else {
    return listOfFatiguedActivities + ',' + activityName;
   }
}

 

 

Since both the custom code blocks are running, View count for experience 2 is also incremented even when the experience is not displayed to user due to it's lower priority.  

 

Note: We would need to increment the view count in a similar way to how Analytics for Target would increment an impression. I am assuming activities with a lower priority do not record an impression in Analytics even though the activity is loaded and higher priority activities are displayed in the browser. 

 

Avatar

Level 3

Hi Suneel,

 

I have not encountered this type of scenario. Let me approach with this request.

Also for Analytics for Target or Target Reporting it will count the impression for both activities as well.

 

Thanks

Karuppiah

Avatar

Administrator

Thanks for posting your question @SuneelKumarV, and thanks for sharing your insights @Karuppiah_Sakthivel@SuneelKumarV were you able to find a solution here ultimately? 

Avatar

Correct answer by
Community Advisor

Are you running both of these Activities on your global mbox/location? If so, the global location is configured to return ALL activities that you qualify for and order the return array in accordance with the priority levels. You will have to build custom handling for the "apply" portion of global location. 

 

I would recommend moving to a named mbox / location which is configured to only return ONE thing back to the browser, which should be the higher priority one.