@reuters-graphics/graphics-components 1.1.5 → 1.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Analytics/Analytics.svelte +4 -1
- package/dist/components/Analytics/providers/index.d.ts +1 -0
- package/dist/components/Analytics/providers/index.js +1 -0
- package/dist/components/Analytics/providers/parsely.d.ts +3 -0
- package/dist/components/Analytics/providers/parsely.js +29 -0
- package/dist/components/SEO/SEO.svelte +2 -2
- package/dist/globals.d.ts +8 -0
- package/package.json +1 -1
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
<script context="module">
|
|
2
2
|
import { registerPageview as registerChartbeatPageview } from './providers/chartbeat';
|
|
3
3
|
import { registerPageview as registerGAPageview } from './providers/ga';
|
|
4
|
+
import { registerPageview as registerParselyPageview } from './providers/parsely';
|
|
4
5
|
|
|
5
6
|
/** Register virtual pageviews when using client-side routing in multipage applications. */
|
|
6
7
|
export function registerPageview() {
|
|
7
8
|
registerChartbeatPageview();
|
|
8
9
|
registerGAPageview();
|
|
10
|
+
registerParselyPageview();
|
|
9
11
|
}
|
|
10
12
|
</script>
|
|
11
13
|
|
|
12
14
|
<!-- @component `Analytics` [Read the docs.](https://reuters-graphics.github.io/graphics-components/?path=/docs/components-Analytics--default) -->
|
|
13
15
|
<script>export let authors = [];
|
|
14
16
|
import { onMount } from "svelte";
|
|
15
|
-
import { ga, chartbeat } from "./providers";
|
|
17
|
+
import { ga, chartbeat, parsely } from "./providers";
|
|
16
18
|
onMount(() => {
|
|
17
19
|
ga();
|
|
18
20
|
chartbeat(authors);
|
|
21
|
+
parsely();
|
|
19
22
|
});
|
|
20
23
|
</script>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const SITE_ID = 'reuters.com';
|
|
2
|
+
const attachScript = () => {
|
|
3
|
+
const b = document.body;
|
|
4
|
+
const e = document.createElement('script');
|
|
5
|
+
e.id = 'parsely-cfg';
|
|
6
|
+
e.src = `//cdn.parsely.com/keys/${SITE_ID}/p.js`;
|
|
7
|
+
e.setAttribute('async', '');
|
|
8
|
+
e.setAttribute('defer', '');
|
|
9
|
+
b.appendChild(e);
|
|
10
|
+
};
|
|
11
|
+
export default () => {
|
|
12
|
+
window.PARSELY = window.PARSELY || {
|
|
13
|
+
autotrack: false,
|
|
14
|
+
onReady() {
|
|
15
|
+
window.PARSELY.updateDefaults({
|
|
16
|
+
data: {
|
|
17
|
+
is_logged_in: false,
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
window.PARSELY.beacon.trackPageView();
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
attachScript();
|
|
24
|
+
};
|
|
25
|
+
export const registerPageview = () => {
|
|
26
|
+
if (typeof window === 'undefined' || !window.PARSELY)
|
|
27
|
+
return;
|
|
28
|
+
window.PARSELY.beacon.trackPageView();
|
|
29
|
+
};
|
|
@@ -19,7 +19,7 @@ const getOrigin = (baseUrl2) => {
|
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
21
|
$: origin = getOrigin(baseUrl);
|
|
22
|
-
$: canonicalUrl = (origin + pageUrl
|
|
22
|
+
$: canonicalUrl = (origin + pageUrl?.pathname).replace(/index\.html\/$/, "");
|
|
23
23
|
const orgLdJson = {
|
|
24
24
|
"@context": "http://schema.org",
|
|
25
25
|
"@type": "NewsMediaOrganization",
|
|
@@ -62,9 +62,9 @@ $: articleLdJson = {
|
|
|
62
62
|
name,
|
|
63
63
|
url
|
|
64
64
|
})),
|
|
65
|
+
creator: authors.map(({ name }) => name),
|
|
65
66
|
articleSection: "Graphics",
|
|
66
67
|
isAccessibleForFree: true,
|
|
67
|
-
creator: ["Reuters Graphics"],
|
|
68
68
|
keywords: ["Reuters graphics", "Reuters", "graphics", "Interactives"]
|
|
69
69
|
};
|
|
70
70
|
</script>
|
package/dist/globals.d.ts
CHANGED