Profil script - Counter mbox views | Community
Skip to main content
May 3, 2023
Solved

Profil script - Counter mbox views

  • May 3, 2023
  • 2 replies
  • 1224 views

Hi everyone,

 

I want to configure a profil script who is going to count the number of time that the mbox was viewed by a visitor.

 

After two times that my mbox was viewed by the user, the visitor is no more able to see the activity.

 

Ex : I have an activity that I want only to show to the user two times.

 

name of the mbox = home

 

it's possible to do that by a profil script ? 

activity name = Security Ad

 

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 nnakirikanti

@a2896 this would be simple, setup a profile script with a name as per your preference and add this code and replace xyz as per mbox id and <<profile-script-name>> placeholder with profile script name. Create audience with visitor profile attributes nd select the profile script name you just created with evaluator as <= with static value comparison as 2. Finally use this audience as eligibility criteria.

 

if (mbox.name == 'xyz') { return (user.get(<<profile-script-name>>) || 0) + 1; } }

 

#sample screenshot

 

 

 

2 replies

nnakirikanti
Community Advisor
nnakirikantiCommunity AdvisorAccepted solution
Community Advisor
May 4, 2023

@a2896 this would be simple, setup a profile script with a name as per your preference and add this code and replace xyz as per mbox id and <<profile-script-name>> placeholder with profile script name. Create audience with visitor profile attributes nd select the profile script name you just created with evaluator as <= with static value comparison as 2. Finally use this audience as eligibility criteria.

 

if (mbox.name == 'xyz') { return (user.get(<<profile-script-name>>) || 0) + 1; } }

 

#sample screenshot

 

 

 

A2896Author
May 5, 2023

@nnakirikanti  Many thanks for your answer, I'm going to try your solution.  Thanks