Creating Audiences Based on user.endpoint.lastViewedEntity | Community
Skip to main content
miahi
New Participant
May 9, 2024
Solved

Creating Audiences Based on user.endpoint.lastViewedEntity

  • May 9, 2024
  • 1 reply
  • 1187 views

Hello!

I'm looking for some guidance on creating audiences using the user.endpoint.lastViewedEntity attribute in Adobe Target.

I want to create two separate audience segments:

  1. Visitors with Data:

    • Criteria: Users whose user.endpoint.lastViewedEntity contains "text".
    • Recommendations:
      • Audience: Visitors with Data.
      • Criteria: Combination of "Most Recently Visited" for pages they have visited, and fallback to "Most Viewed Pages" for others.
      • Design: Headline should read "Recommended for you". Display the printers first by most recently visited pages, then by most viewed pages for unvisited printers.
  2. Visitors without Data:

    • Criteria: Users whose user.endpoint.lastViewedEntity doesn't contain "text".
    • Recommendations:
      • Audience: Visitors without Data.
      • Criteria: Use the "Most Viewed Pages" criteria.
      • Design: Change the headline to "Top picks" and display the printers in the order of the most viewed pages.

My Question: How can I create these two audience segments based on the user.endpoint.lastViewedEntity attribute?

Any help would be greatly appreciated!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by alexbishop

Did a bit more digging - you can actually access user.endpoint.lastViewedEntity (including all historical last viewed entities) via profile script. So a simple example would be:

var lastViewedEntity= user.get('endpoint.lastViewedEntity')+""; if(lastViewedEntity != 'null'){ return lastViewedEntity; }

 

1 reply

alexbishop
Employee
May 10, 2024

That user.endpoint.lastViewedEntity parameter isn't available "out of the box" in the audience creation workflow. However, you can access it quite easily via a Profile Script. 

If it's only the single most recent entity, your profile script could just be something like

var lastViewed = mbox.param("entity.id"); if (lastViewed) { return lastViewed }

And then if your profile script is named "returnLastViewed", for example, your Audience definition would then be
 

If you want to look beyond just the very last entity viewed, you could develop the profile script further e.g., each time the entity.id param exists, append the ID to a comma-separated string. 

miahi
miahiAuthor
New Participant
May 10, 2024

I don't need only the last entity or the entities captured from now into the future; I need all historical last viewed entities as they are in user.endpoint.lastViewedEntity.

Based on your reply, I'm assuming it's not possible?


Thank you!

alexbishop
alexbishopAccepted solution
Employee
May 14, 2024

Did a bit more digging - you can actually access user.endpoint.lastViewedEntity (including all historical last viewed entities) via profile script. So a simple example would be:

var lastViewedEntity= user.get('endpoint.lastViewedEntity')+""; if(lastViewedEntity != 'null'){ return lastViewedEntity; }