This is most viewed un-answered question, hence why I'm replying to a 4 year old question
Overall the code checks with Target if there's an activity for the page where the request is made. If there is, it will apply the activity. The code itself is typically used if you need to trigger Target outside of a page load.
So your example of a customer answering a question and based on the answer you want to trigger Target again to re-evaluate or give provide a certain experience. And you want to do this without reloading the page.
Another example could be that users enters site, gives consent and instead of reloading the page to fire Target code, you execute the getOffer and applyOffer functions.
Basically, a customer answers a question and based on that answer I want to put them into an audience and change some content on the page at the same time.
What I want to understand is if the code above does all those things at once:
- Updates the profile parameter
- Evaluates what audience the customer falls into
- Delivers the appropriate on page content for that audience
Many thanks!
1. Yes, in the params section of the code you can set profile parameters that will update the profile.
2. Yes, by triggering these Target will evaluate in similar way as if the page was reloaded.
3. Yes, if there is an activity and the user qualified for it, then it will deliver it. Be aware that depending on the element being changed and since there is no reload of the page, the user will most likely experience a flicker when Target changes the content.