Skip to content

Commit 6a6a663

Browse files
authored
Merge pull request #177 from segmentio/pr/161
[DEST-937] Update Fullstory crossorigin flag and add `fs.log
2 parents a582549 + 1afb980 commit 6a6a663

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

integrations/fullstory/HISTORY.md

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11

2+
2.2.1 / 2019-08-09
3+
==================
4+
5+
* Enable cross-origin access to errors from fs.js.
6+
* Make FS.log not throw an exception if it is called before FS is ready.
7+
28
2.1.4 / 2018-05-01
39
==================
410

@@ -15,12 +21,12 @@
1521
2.1.2 / 2017-01-24
1622
==================
1723

18-
* Fix error when null is passed as a trait value
24+
* Fix error when null is passed as a trait value
1925

2026
2.1.1 / 2017-01-03
2127
==================
2228

23-
* Remove option to override default namespace
29+
* Remove option to override default namespace
2430

2531
2.1.0 / 2017-01-03
2632
==================

integrations/fullstory/lib/index.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ var integration = require('@segment/analytics.js-integration');
1717
var 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

integrations/fullstory/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@segment/analytics.js-integration-fullstory",
33
"description": "The Fullstory analytics.js integration.",
4-
"version": "2.2.0",
4+
"version": "2.2.1",
55
"keywords": [
66
"analytics.js",
77
"analytics.js-integration",

0 commit comments

Comments
 (0)