Expand my Community achievements bar.

SOLVED

Profile script: Has seen pages?

Avatar

Level 2

Hi,

I'm hoping to set up a profile script to create a user parameter which tells me whether or not the user has viewed a certain set of pages before. This must be across sessions.

At the moment I have this for my script called 'LastContentPage: 

if(!user.get("LastContentPage")){
  if(mbox.name==="target-global-mbox" && page.url.includes("contentpage")){
    return 'Content Page';
}

The script is referring to the global mbox to grab a page URL. If that URL contains 'contentpage', then a parameter is passed to the user. I'd then set up a rule saying 'If this user parameter equals "Content Page", apply offer'.

Will this work? How can I test it without applying it directly to an activity?

Thanks,

Chris

1 Accepted Solution

Avatar

Correct answer by
Level 6

Hi Chris,

I'm not sure about the 'include' method, don't know if that exists. The following would work, and since you just want to set a flag if the user sees a URL containing a certain value, I would use something like this:

if (mbox.url.indexOf("contentpage") == -1) {
    return "Content Page"
}

In order to test it, I would setup a 'test experiment' where you do a combination, where both the profile need to match and you need a specific value in a query string. When I test for clients I do it that way, to avoid making customer facing changes.
I'm not sure if the profile will be visible in your audience builder as soon as you create the profile, or if it first appears when it has some data... In case it first appears when you have data, that could also be a way of testing it...

As an alternative, setup a test with your new audience, on a page where you make no changes and then deploy it for a short time to see if any data comes in.

/Løjmann

Lead Solution Architect
eCapacity.com

View solution in original post

1 Reply

Avatar

Correct answer by
Level 6

Hi Chris,

I'm not sure about the 'include' method, don't know if that exists. The following would work, and since you just want to set a flag if the user sees a URL containing a certain value, I would use something like this:

if (mbox.url.indexOf("contentpage") == -1) {
    return "Content Page"
}

In order to test it, I would setup a 'test experiment' where you do a combination, where both the profile need to match and you need a specific value in a query string. When I test for clients I do it that way, to avoid making customer facing changes.
I'm not sure if the profile will be visible in your audience builder as soon as you create the profile, or if it first appears when it has some data... In case it first appears when you have data, that could also be a way of testing it...

As an alternative, setup a test with your new audience, on a page where you make no changes and then deploy it for a short time to see if any data comes in.

/Løjmann

Lead Solution Architect
eCapacity.com