Profile Script for inactivty on 15sec on web page | Community
Skip to main content
RudraChaudhari
Level 2
May 4, 2022
Solved

Profile Script for inactivty on 15sec on web page

  • May 4, 2022
  • 1 reply
  • 1041 views

Hi,

I need to show some banners after user inactivty of 15 sec on web page, I written JS code which is running on console but giving an error as "Invalid user input" on Target's profile script.

 

var time;
document.onload = resetTimer;
document.onmousemove = resetTimer;
document.onmousedown = resetTimer; // touchscreen presses
document.ontouchstart = resetTimer;

document.onclick = resetTimer; // touchpad clicks
function popup()
{return true; }
function resetTimer() {
clearTimeout(time);
time = setTimeout(popup, 15000);
}

 

can someone please guide me how I can use this as profile script? so based on this audience can be created.

 

@lj_jones  @paritmittal @nickhomer @løjmann 

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 Moses_Maxen

Hi @rudrachaudhari - Profile Scripts leverage JS Rhino and function differently than client side executed javascript.   For your use case, it would probably be better to deliver the javascript through a Target offer either using the VEC (Custom Code) or the Form Based composer.   For reference, we also have some sample templates including one for a modal on a timer which can be viewed here.  Try delivering it through an activity to the page rather than using Profile Scripts which are executed server side on Target's servers.  

1 reply

Moses_MaxenAdobe EmployeeAccepted solution
Adobe Employee
May 4, 2022

Hi @rudrachaudhari - Profile Scripts leverage JS Rhino and function differently than client side executed javascript.   For your use case, it would probably be better to deliver the javascript through a Target offer either using the VEC (Custom Code) or the Form Based composer.   For reference, we also have some sample templates including one for a modal on a timer which can be viewed here.  Try delivering it through an activity to the page rather than using Profile Scripts which are executed server side on Target's servers.