Issue
JavaScript custom code is working on some Streams, but is not working on Streams where a personalizer app (Query String/6sense/Demandbase/Bombora) is enabled.
- Custom code problem on some Streams
- JavaScript issue on Streams with personalizer app
- JavaScript race condition after installing personalizer app
Conditions
- JavaScript code implemented on affected Hub using Custom Code blocks
- One or more personalizer apps installed on the affected Hub:
- Query String Personalizer App
- 6sense Personalizer App
- Demandbase Personalizer App
- Bombora Personalizer App
- Personalizer app is enabled on affected Stream(s)
- Where: Stream and Item pages on which a personalizer app has been enabled
- Who: Any user viewing an affected Stream or Item page
- When: After installing a personalizer app and configuring it to run on the affected Stream(s)
- Any browser
- Any operating system
Cause
Personalizer apps manipulate a large portion of Stream and Item pages. As a result, a race condition can occur: other JavaScript running on the same page will usually execute faster, and will be undone by the extensive changes that the personalizer app makes.
Steps to Fix
If you are experiencing this issue, use the callback function built into all Uberflip personalizer apps (Query String/6sense/Demandbase/Bombora) to resolve the race condition.
To use, create a function named ufPersonalizerCallback
in your custom code block and place the affected JS inside it. For example:
<script>
var ufPersonalizerCallback = function(){
/** Your JS **/
};
</script>
This function is called once the personalizer app has finished executing its own code, which ensures that any JavaScript code within the callback function is executed later and can't be affected by the personalizer app.