@@ -17,7 +17,9 @@ var integration = require('@segment/analytics.js-integration');
17
17
var FullStory = ( module . exports = integration ( 'FullStory' )
18
18
. option ( 'org' , '' )
19
19
. 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
+ ) ) ;
21
23
22
24
/**
23
25
* The ApiSource string.
@@ -37,11 +39,13 @@ FullStory.prototype.initialize = function() {
37
39
38
40
/* eslint-disable */
39
41
/* istanbul ignore next */
42
+ /* The snippet below differs slightly from the snippet available on fullstory.com because fs.js is already loaded above*/
40
43
( function ( m , n , e , t , l , o , g , y ) {
41
44
if ( e in m ) { if ( m . console && m . console . log ) { m . console . log ( 'FullStory namespace conflict. Please set window["_fs_namespace"].' ) ; } return ; }
42
45
g = m [ e ] = function ( a , b , s ) { g . q ?g . q . push ( [ a , b , s ] ) :g . _api ( a , b , s ) ; } ; g . q = [ ] ;
43
46
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 ) } ;
44
47
g . shutdown = function ( ) { g ( "rec" , ! 1 ) } ; g . restart = function ( ) { g ( "rec" , ! 0 ) } ;
48
+ g . log = function ( a , b ) { g ( "log" , [ a , b ] ) } ;
45
49
g . consent = function ( a ) { g ( "consent" , ! arguments . length || a ) } ;
46
50
g . identifyAccount = function ( i , v ) { o = 'account' ; v = v || { } ; v . acctId = i ; g ( o , v ) } ;
47
51
g . clearUserCookie = function ( ) { } ;
@@ -73,12 +77,13 @@ FullStory.prototype.identify = function(identify) {
73
77
74
78
var newTraits = foldl (
75
79
function ( results , value , key ) {
80
+ var rs = results ;
76
81
if ( key !== 'id' ) {
77
- results [
82
+ rs [
78
83
key === 'displayName' || key === 'email' ? key : camelCaseField ( key )
79
84
] = value ;
80
85
}
81
- return results ;
86
+ return rs ;
82
87
} ,
83
88
{ } ,
84
89
traits
0 commit comments