Help with a profile script needed!! | Community
Skip to main content
New Participant
April 5, 2023
Solved

Help with a profile script needed!!

  • April 5, 2023
  • 1 reply
  • 1633 views

Hi! I am trying to create an audience for an XT which includes a profile script. The audience will show a certain menu to users who visit the site with ?att=ps6260 as a parameter in their URL, and the profile script needs to then serve the same experience to users who return to the site but this time without the URL attribute (but who had it on their previous visit)

I've found this for URL attributes, but I think this one is just applying the URL parameter to all pages of a visit, not storing it from a previous visit:

 

if (page.query.indexOf('att=ps6260') > -1) {
return 1;
}else{
if (!user.get('BCorp_return_visitor')) {
return 0;
}
}

 

Any help would be very much appreciated!! 🙂 

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 evidana

Hi - @clairea39507456  

 

This looks like it should work. If it sees the att=ps6260 query string param then set the user attribute to 1. If you wanted to clean it up a little bit, you probably don't need the else statement. That way the profile script only ever runs if the query string param is present. The options would then be 1 and null instead of 1 and 0. 

1 reply

evidanaAccepted solution
New Participant
April 5, 2023

Hi - @clairea39507456  

 

This looks like it should work. If it sees the att=ps6260 query string param then set the user attribute to 1. If you wanted to clean it up a little bit, you probably don't need the else statement. That way the profile script only ever runs if the query string param is present. The options would then be 1 and null instead of 1 and 0. 

New Participant
April 5, 2023

Thanks - but what about returning customers who once had the at=ps6260 query string param but on their next visit it isn't present anymore - will this still account for them?

New Participant
April 5, 2023

Absolutely. Target accounts for this by using a session cookie (mbox) which sticks to the browser until cleared.