|
| 1 | +/* eslint-disable */ |
| 2 | +const snippet = ({ |
| 3 | + orgId, |
| 4 | + namespace = 'FS', |
| 5 | + debug = false, |
| 6 | + host = 'fullstory.com', |
| 7 | + script = 'edge.fullstory.com/s/fs.js' |
| 8 | +}) => { |
| 9 | + if (!orgId) { |
| 10 | + throw new Error('FullStory orgId is a required parameter'); |
| 11 | + } |
| 12 | + /* begin FullStory snippet */ |
| 13 | + window._fs_debug = debug; |
| 14 | + window._fs_host = host; |
| 15 | + window._fs_script = script; |
| 16 | + window._fs_org = orgId; |
| 17 | + window._fs_namespace = namespace; |
| 18 | + (function(m, n, e, t, l, o, g, y) { |
| 19 | + if (e in m) { |
| 20 | + if (m.console && m.console.log) { |
| 21 | + m.console.log( |
| 22 | + 'FullStory namespace conflict. Please set window["_fs_namespace"].' |
| 23 | + ); |
| 24 | + } |
| 25 | + return; |
| 26 | + } |
| 27 | + g = m[e] = function(a, b, s) { |
| 28 | + g.q ? g.q.push([a, b, s]) : g._api(a, b, s); |
| 29 | + }; |
| 30 | + g.q = []; |
| 31 | + o = n.createElement(t); |
| 32 | + o.async = 1; |
| 33 | + o.crossOrigin = 'anonymous'; |
| 34 | + o.src = 'https://' + m._fs_script; |
| 35 | + y = n.getElementsByTagName(t)[0]; |
| 36 | + y.parentNode.insertBefore(o, y); |
| 37 | + g.identify = function(i, v, s) { |
| 38 | + g(l, { uid: i }, s); |
| 39 | + if (v) g(l, v, s); |
| 40 | + }; |
| 41 | + g.setUserVars = function(v, s) { |
| 42 | + g(l, v, s); |
| 43 | + }; |
| 44 | + g.event = function(i, v, s) { |
| 45 | + g('event', { n: i, p: v }, s); |
| 46 | + }; |
| 47 | + g.shutdown = function() { |
| 48 | + g('rec', !1); |
| 49 | + }; |
| 50 | + g.restart = function() { |
| 51 | + g('rec', !0); |
| 52 | + }; |
| 53 | + g.log = function(a, b) { |
| 54 | + g('log', [a, b]); |
| 55 | + }; |
| 56 | + g.consent = function(a) { |
| 57 | + g('consent', !arguments.length || a); |
| 58 | + }; |
| 59 | + g.identifyAccount = function(i, v) { |
| 60 | + o = 'account'; |
| 61 | + v = v || {}; |
| 62 | + v.acctId = i; |
| 63 | + g(o, v); |
| 64 | + }; |
| 65 | + g.clearUserCookie = function() {}; |
| 66 | + })(window, document, window['_fs_namespace'], 'script', 'user'); |
| 67 | + /* end FullStory snippet */ |
| 68 | +}; |
| 69 | + |
| 70 | +export default snippet; |
0 commit comments