Expand my Community achievements bar.

SOLVED

Help with a profile script needed!!

Avatar

Level 3

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!!  

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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. 

View solution in original post

4 Replies

Avatar

Correct answer by
Community Advisor

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. 

Avatar

Level 3

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?

Avatar

Community Advisor

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