Context
Sometimes the out of the box Audiences provided by Target will not be enough for your use cases, sometime your audience needs a bit more logic applied to it. The answer to this issue is with Adobe Target’s Profile Script. Using Profile scripts you can manipulate or compare custom parameters , apply your own business logic to audience qualification. Below is a demonstration on using Profile Script to count the number of time a user can see an experience before they are not shown it again.
Example Use Case: As a Marketing Director , I want my visitor to see couple of experience in order. When they have viewed the first experience 3 times , they should not see this experience again but see the next one, when they have viewed the nexts experience 3 times, they should move onto the next one. Once they have viewed all experience they will only see the default
Instructions
The below quote should show a Count Down into an image. Each time you refresh the page 3 times, the count down should move. Once you get to the end it will be the default image.
How it all works
Products/Tools Used:
Adobe Launch
Adobe Target
Adobe Launch
Launch was just used here to load the Target Libraries into the page as well as send the custom activity ID as a mBox parameter to be picked up by the profile scripts. This was done because profile script will not be able to tell what activity you are in at the moment as activity qualification happens after profile script are executed.
Adobe Target
There is quite a bit of setup required for this.
Firstly a profile script must be created to contain the logic. Inside this script we grab a user parameter that holds how many times this count has been incremented. if it doesn’t exist we just set it to 0. We then compare the activityID in the mBox Parameter with our target activityID, if they match we increment by 1. Afterward we save the new value into the user profile, lastly we return the value of the count. The profile script was called “countDown”
Secondly, we create Audience based on the count. As an example we created the following Audience using the Visitor Profiles with my profile script created above
Audience Name | Rules |
---|---|
Count Down 3 | user.countDown <= 3 |
Count Down 2 | user.countDown <= 6 |
Count Down 1 | user.countDown <= 9 |
Lastly , an Experience Targeting Activity was setup. The experience include the three audience created above and the default one which has the image. The main setup to point out here was the ordering of the experience, since each time an experience was loaded 3 time , the next one will need to show up. So the ordering was experience was done as below
Count Down 3
Count Down 2
Count Down 1
Default Experience
Learnings & Gotchas
Profile Scripts are ran before Activity Qualification
Profile Scripts run on every mBox call