User Has Seen A Url Parameter
Aug 21, 2017Below is an example of an Adobe Target Profile Script that records if a visitor has had a particular parameter in the url. It is based off of matching against the url parameters and could re-purposed for any url parameter.
This script checks to see if the visitor’s url matches the parameter campaign=summer. If they have, it stores in the profile script summerCampaign a value of 1, indicating that the user saw that parameter in the url. This is stored and can be used and referenced on other subsequent pages.
return 1;
}else{
if (!user.get('summerCampaign')) {
return 0;
}
}
The else statement is just a best practice to set all other users to 0, indicating that they have not seen the url parameter.
The name of this profile script would be summerCampaign. Notice that within the profile script, the script can reference itself. In this case it checks to see if summerCampaign is already set so that it doesn’t overwrite itself if the user saw the parameter on an earlier page.