diff --git a/ghost/portal/src/analytics.js b/ghost/portal/src/analytics.js deleted file mode 100644 index 801cc9a709..0000000000 --- a/ghost/portal/src/analytics.js +++ /dev/null @@ -1,21 +0,0 @@ -import setupGhostApi from './utils/api'; - -function sendEntryViewEvent({analyticsId, api}) { - if (analyticsId) { - api.analytics.pushEvent({ - type: 'entry_view', - entry_id: analyticsId, - entry_url: window.location.href, - created_at: new Date() - }); - } -} - -function setupAnalytics({siteUrl, analyticsId}) { - const GhostApi = setupGhostApi({siteUrl}); - // Fire page/post view event - sendEntryViewEvent({analyticsId, api: GhostApi}); - return {}; -} - -export default setupAnalytics; diff --git a/ghost/portal/src/index.js b/ghost/portal/src/index.js index 9d79ade749..fc8a9dd54a 100644 --- a/ghost/portal/src/index.js +++ b/ghost/portal/src/index.js @@ -2,7 +2,6 @@ import React from 'react'; import ReactDOM from 'react-dom'; import './index.css'; import App from './App'; -import setupAnalytics from './analytics'; const ROOT_DIV_ID = 'ghost-portal-root'; @@ -34,18 +33,9 @@ function handleTokenUrl() { } } -function setupAnalyticsScript({siteUrl}) { - const analyticsTag = document.querySelector('meta[name=ghost-analytics-id]'); - const analyticsId = analyticsTag?.content; - if (siteUrl && analyticsTag) { - setupAnalytics({siteUrl, analyticsId}); - } -} - function setup({siteUrl}) { addRootDiv(); handleTokenUrl(); - setupAnalyticsScript({siteUrl}); } function init() { diff --git a/ghost/portal/src/utils/api.js b/ghost/portal/src/utils/api.js index 854e3bc1b1..04316d42b6 100644 --- a/ghost/portal/src/utils/api.js +++ b/ghost/portal/src/utils/api.js @@ -28,30 +28,6 @@ function setupGhostApi({siteUrl = window.location.origin, apiUrl, apiKey}) { } const api = {}; - api.analytics = { - async pushEvent(event) { - const url = endpointFor({type: 'members', resource: 'events'}); - const identity = await api.member.identity(); - event.identity = identity; - const body = { - events: [event] - }; - return makeRequest({ - url, - method: 'POST', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(body) - }).then(function (res) { - if (!res.ok) { - return null; - } - return res.text(); - }); - } - }; - api.site = { read() { const url = endpointFor({type: 'members', resource: 'site'});