From c802e8846a1d75b558b3fcc68e6e764438eded96 Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Tue, 22 Sep 2020 14:26:13 +0000 Subject: [PATCH] BREAKING CHANGE(core): update --- ts/index.ts | 13 -------- ts/tools/fullstory.ts | 70 ------------------------------------------ ts/tools/ganalytics.ts | 32 ------------------- 3 files changed, 115 deletions(-) delete mode 100644 ts/tools/fullstory.ts delete mode 100644 ts/tools/ganalytics.ts diff --git a/ts/index.ts b/ts/index.ts index 2031d59..2f61a98 100644 --- a/ts/index.ts +++ b/ts/index.ts @@ -1,12 +1,7 @@ import * as plugins from './websetup.plugins'; - -import { setupGoogleAnalytics } from './tools/ganalytics'; -import { setupFullStory } from './tools/fullstory'; import { IMetaObject, setupMetaInformation } from './meta'; export interface IWebSetupConstructorOptions { - googleAnalyticsCode?: string; - fsCode?: string; metaObject: IMetaObject; } @@ -21,13 +16,5 @@ export class WebSetup { public async setup() { await setupMetaInformation(this.options.metaObject); - - if (this.options.googleAnalyticsCode) { - await setupGoogleAnalytics(this.options.googleAnalyticsCode); - } - - if (this.options.fsCode) { - await setupFullStory(this.options.fsCode); - } } } diff --git a/ts/tools/fullstory.ts b/ts/tools/fullstory.ts deleted file mode 100644 index eda464c..0000000 --- a/ts/tools/fullstory.ts +++ /dev/null @@ -1,70 +0,0 @@ -declare global { - // tslint:disable-next-line: interface-name - interface Window { - _fs_debug: boolean; - _fs_host: any; - _fs_org: string; - _fs_namespace: string; - } -} -export const setupFullStory = async (fsCodeArg: string) => { - // tslint:disable-next-line: no-string-literal - window['_fs_debug'] = false; - // tslint:disable-next-line: no-string-literal - window['_fs_host'] = 'fullstory.com'; - // tslint:disable-next-line: no-string-literal - window['_fs_org'] = fsCodeArg; - // tslint:disable-next-line: no-string-literal - window['_fs_namespace'] = 'FS'; - ((m, n, e, t, l, o, g, y) => { - if (e in m) { - if (m.console && m.console.log) { - m.console.log('FullStory namespace conflict. Please set window["_fs_namespace"].'); - } - return; - } - // tslint:disable-next-line: only-arrow-functions - g = m[e] = function (a, b, s) { - g.q ? g.q.push([a, b, s]) : g._api(a, b, s); - }; - g.q = []; - o = n.createElement(t); - o.async = 1; - o.src = 'https://' + window._fs_host + '/s/fs.js'; - o.crossorigin = 'anonymous'; - y = n.getElementsByTagName(t)[0]; - y.parentNode.insertBefore(o, y); - // tslint:disable-next-line: only-arrow-functions - 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); - }; - // tslint:disable-next-line: only-arrow-functions - g.shutdown = function () { - g('rec', !1); - }; - g.restart = function () { - g('rec', !0); - }; - // tslint:disable-next-line: only-arrow-functions - g.consent = function (a) { - g('consent', !arguments.length || a); - }; - // tslint:disable-next-line: only-arrow-functions - g.identifyAccount = function (i, v) { - o = 'account'; - v = v || {}; - v.acctId = i; - g(o, v); - }; - // tslint:disable-next-line: only-arrow-functions - g.clearUserCookie = function () {}; - // tslint:disable-next-line: no-string-literal - })(window, document, window['_fs_namespace'], 'script', 'user'); -}; diff --git a/ts/tools/ganalytics.ts b/ts/tools/ganalytics.ts deleted file mode 100644 index ea07e01..0000000 --- a/ts/tools/ganalytics.ts +++ /dev/null @@ -1,32 +0,0 @@ -declare global { - // tslint:disable-next-line: interface-name - interface Window { - analytics: any; - } -} - -export const setupGoogleAnalytics = async (gaCode: string) => { - // tslint:disable-next-line: only-arrow-functions - (function (i, s, o, g, r, a, m) { - // tslint:disable-next-line: no-string-literal - i['GoogleAnalyticsObject'] = r; - // tslint:disable-next-line: ban-comma-operator - (i[r] = - i[r] || - // tslint:disable-next-line: only-arrow-functions - function () { - (i[r].q = i[r].q || []).push(arguments); - }), - (i[r].l = new Date().getTime()); - // tslint:disable-next-line: ban-comma-operator - (a = s.createElement(o)), (m = s.getElementsByTagName(o)[0]); - a.async = 1; - a.src = g; - a.crossorigin = 'anonymous'; - m.parentNode.insertBefore(a, m); - })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'analytics'); - - window.analytics('create', gaCode, 'auto'); - window.analytics('send', 'pageview'); - console.log('Loaded Google Analytics. You may view our privacy policy at https://lossless.gmbh'); -};