Fetch the name of last viewed page in target offer for a logged in user | Community
Skip to main content
New Participant
July 8, 2023
Solved

Fetch the name of last viewed page in target offer for a logged in user

  • July 8, 2023
  • 1 reply
  • 565 views

Hi ,

Is there any way we can fetch the name of last viewed page in target for a logged in user.
This page was viewed by user when he logged into the site last time.

 

We want to show user the last viewed page after he has logged out and logged again.

Is there any way we can do that?

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 Rajneesh_Gautam_

hi @rkmk107  - as long as you are sending the page-name and logged-in-state to Adobe Target (as parameters) then you can use Profile scripts to capture the page-name for the last-viewed-page. Here's an example code (you may need to change the variable names)

 

if (mbox.param('logged_in_status') && mbox.param('logged_in_status') == "logged-in" && mbox.param('page_name')){ return mbox.param('page_name'); }

 

You can then access the last viewed page-name using the code like below:

var last_viewed_page = "${user.YOUR_PROFILE_ATTRIBUTE}";

 

1 reply

Rajneesh_Gautam_
Rajneesh_Gautam_Accepted solution
New Participant
July 9, 2023

hi @rkmk107  - as long as you are sending the page-name and logged-in-state to Adobe Target (as parameters) then you can use Profile scripts to capture the page-name for the last-viewed-page. Here's an example code (you may need to change the variable names)

 

if (mbox.param('logged_in_status') && mbox.param('logged_in_status') == "logged-in" && mbox.param('page_name')){ return mbox.param('page_name'); }

 

You can then access the last viewed page-name using the code like below:

var last_viewed_page = "${user.YOUR_PROFILE_ATTRIBUTE}";