Expand my Community achievements bar.

SOLVED

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

Avatar

Level 3

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?

Topics

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

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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}";

 

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

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}";