File tree 1 file changed +10
-5
lines changed
Integrations/Analytics/Moat Analytics
1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change 1
1
//Fetch Optimizely State
2
2
var state = optimizely . get ( 'state' ) ;
3
- //Get the current Decision String from the state
3
+ //Use the getDecisionString API to get a string with relevant data from customer
4
4
var string = state . getDecisionString ( { "campaignId" :campaignId , "shouldCleanString" :true } ) ;
5
- //Check for a truthy value for the string indicating a visitor has been successfully bucketed
6
- if ( string ) {
7
- //create or update the window-level optimizelyMoat array with the Decision String if
5
+ //Check for a truthy value for the string indicating a visitor has been successfully bucketed and is relevant for tracking
6
+ if ( string ) {
7
+ //Split the generated string, replacing colons with '|' after the first to fit within Moat's slicer logic
8
+ var array = string . split ( ':' ) ;
9
+ var key = array [ 0 ] ;
10
+ var value = array . slice ( 1 ) . join ( '|' ) ;
11
+ var pipe_string = key + ':' + value ;
12
+ //Push value new value to optimizelyMoat object
8
13
window . optimizelyMoat = window . optimizelyMoat || [ ] ;
9
- window . optimizelyMoat . push ( string ) ;
14
+ window . optimizelyMoat . push ( pipe_string ) ;
10
15
}
You can’t perform that action at this time.
0 commit comments