Merge pull request #323 from reuters-graphics/rm-parsely

AB# DONE: Remove Parse.ly integration from Graphics pages
This commit is contained in:
Jon McClure 2025-06-25 17:13:08 +01:00 committed by GitHub
commit 3ae55fab6f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 6 additions and 45 deletions

View file

@ -0,0 +1,5 @@
---
'@reuters-graphics/graphics-components': patch
---
Removes Parsely page analytics

View file

@ -3,13 +3,11 @@
<script module>
import { registerPageview as registerChartbeatPageview } from './providers/chartbeat';
import { registerPageview as registerGAPageview } from './providers/ga';
import { registerPageview as registerParselyPageview } from './providers/parsely';
/** Register virtual pageviews when using client-side routing in multipage applications. */
function registerPageview() {
registerChartbeatPageview();
registerGAPageview();
registerParselyPageview();
}
export { registerPageview };
@ -21,7 +19,7 @@
}
import { onMount } from 'svelte';
import { ga, chartbeat, parsely } from './providers';
import { ga, chartbeat } from './providers';
interface Props {
/**
* Used to associate a page with its author(s) in Chartbeat.
@ -34,6 +32,5 @@
onMount(() => {
ga();
chartbeat(authors);
parsely();
});
</script>

View file

@ -1,3 +1,2 @@
export { default as ga } from './ga';
export { default as chartbeat } from './chartbeat';
export { default as parsely } from './parsely';

View file

@ -1,32 +0,0 @@
const SITE_ID = 'reuters.com';
const attachScript = () => {
const b = document.body;
const e = document.createElement('script');
e.id = 'parsely-cfg';
e.src = `//cdn.parsely.com/keys/${SITE_ID}/p.js`;
e.setAttribute('async', '');
e.setAttribute('defer', '');
b.appendChild(e);
};
export default () => {
window.PARSELY = window.PARSELY || {
autotrack: false,
onReady() {
window.PARSELY.updateDefaults({
data: {
is_logged_in: false,
},
});
window.PARSELY.beacon.trackPageView();
},
};
attachScript();
};
export const registerPageview = () => {
if (typeof window === 'undefined' || !window.PARSELY) return;
window.PARSELY.beacon.trackPageView();
};

8
src/globals.d.ts vendored
View file

@ -21,14 +21,6 @@ declare global {
};
/** Graphics ads */
graphicsAdQueue: any[];
/** Parsely */
PARSELY: {
onLoad: () => void;
beacon: {
trackPageView: () => void;
};
updateDefaults: (params: any) => void;
};
}
}