@@ -17,7 +17,9 @@ var integration = require('@segment/analytics.js-integration');
1717var FullStory = ( module . exports = integration ( 'FullStory' )
1818 . option ( 'org' , '' )
1919 . option ( 'debug' , false )
20- . tag ( '<script src="https://www.fullstory.com/s/fs.js"></script>' ) ) ;
20+ . tag (
21+ '<script async src="https://www.fullstory.com/s/fs.js" crossorigin="anonymous"></script>'
22+ ) ) ;
2123
2224/**
2325 * The ApiSource string.
@@ -37,11 +39,13 @@ FullStory.prototype.initialize = function() {
3739
3840 /* eslint-disable */
3941 /* istanbul ignore next */
42+ /* The snippet below differs slightly from the snippet available on fullstory.com because fs.js is already loaded above*/
4043 ( function ( m , n , e , t , l , o , g , y ) {
4144 if ( e in m ) { if ( m . console && m . console . log ) { m . console . log ( 'FullStory namespace conflict. Please set window["_fs_namespace"].' ) ; } return ; }
4245 g = m [ e ] = function ( a , b , s ) { g . q ?g . q . push ( [ a , b , s ] ) :g . _api ( a , b , s ) ; } ; g . q = [ ] ;
4346 g . identify = function ( i , v , s ) { g ( l , { uid :i } , s ) ; if ( v ) g ( l , v , s ) } ; g . setUserVars = function ( v , s ) { g ( l , v , s ) } ; g . event = function ( i , v , s ) { g ( 'event' , { n :i , p :v } , s ) } ;
4447 g . shutdown = function ( ) { g ( "rec" , ! 1 ) } ; g . restart = function ( ) { g ( "rec" , ! 0 ) } ;
48+ g . log = function ( a , b ) { g ( "log" , [ a , b ] ) } ;
4549 g . consent = function ( a ) { g ( "consent" , ! arguments . length || a ) } ;
4650 g . identifyAccount = function ( i , v ) { o = 'account' ; v = v || { } ; v . acctId = i ; g ( o , v ) } ;
4751 g . clearUserCookie = function ( ) { } ;
@@ -73,12 +77,13 @@ FullStory.prototype.identify = function(identify) {
7377
7478 var newTraits = foldl (
7579 function ( results , value , key ) {
80+ var rs = results ;
7681 if ( key !== 'id' ) {
77- results [
82+ rs [
7883 key === 'displayName' || key === 'email' ? key : camelCaseField ( key )
7984 ] = value ;
8085 }
81- return results ;
86+ return rs ;
8287 } ,
8388 { } ,
8489 traits
0 commit comments