Skip to content

Commit 17b7ecb

Browse files
committed
Add Plausible analytics snippet
1 parent 8150934 commit 17b7ecb

2 files changed

Lines changed: 19 additions & 3 deletions

File tree

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ jobs:
5252
5353
test -s /tmp/home.html
5454
grep -q "GraphQL Java" /tmp/home.html
55+
grep -q "https://plausible.io/js/pa-p0EwT1dUPS95Hq8MWvpRd.js" /tmp/home.html
5556
5657
curl --fail --silent --show-error http://127.0.0.1:3000/documentation/getting-started > /tmp/docs.html
5758
grep -q "Getting started" /tmp/docs.html

docusaurus.config.js

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33

44
const {themes} = require('prism-react-renderer');
55

6+
const plausibleInitScript = `
7+
window.plausible=window.plausible||function(){(plausible.q=plausible.q||[]).push(arguments)},plausible.init=plausible.init||function(i){plausible.o=i||{}};
8+
plausible.init()
9+
`;
10+
611
/** @type {import('@docusaurus/types').Config} */
712
const config = {
813
title: 'GraphQL Java',
@@ -18,6 +23,19 @@ const config = {
1823
favicon: 'img/favicon.ico',
1924
organizationName: 'graphql-java', // Usually your GitHub org/user name.
2025
projectName: 'graphql-java-page', // Usually your repo name.
26+
headTags: [
27+
{
28+
tagName: 'script',
29+
attributes: {
30+
async: true,
31+
src: 'https://plausible.io/js/pa-p0EwT1dUPS95Hq8MWvpRd.js',
32+
},
33+
},
34+
{
35+
tagName: 'script',
36+
innerHTML: plausibleInitScript,
37+
},
38+
],
2139
presets: [
2240
[
2341
'@docusaurus/preset-classic',
@@ -44,9 +62,6 @@ const config = {
4462
blogSidebarCount: 'ALL',
4563
postsPerPage: 5,
4664
},
47-
googleAnalytics: {
48-
trackingID: 'UA-126627606-1',
49-
},
5065
theme: {
5166
customCss: require.resolve('./src/css/custom.css'),
5267
},

0 commit comments

Comments
 (0)