Skip to content

Commit ae34e70

Browse files
committed
add plausible analytics
1 parent a64c0de commit ae34e70

17 files changed

+65
-15
lines changed

.env.development.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ SITE_URL=http://localhost:3000
55

66
# always true in development, set only on prod build
77
# PREVIEW_MODE=
8+
9+
# plausible analytics url
10+
PLAUSIBLE_SCRIPT_URL=

.env.production.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@ SITE_URL=https://nemanjam.github.io
77
# see draft posts and projects, true | false | empty
88
# optional, default false, set only on prod build
99
PREVIEW_MODE=
10+
11+
# plausible analytics url
12+
PLAUSIBLE_SCRIPT_URL=

.github/workflows/bash__deploy-nginx.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ on:
1313

1414
env:
1515
SITE_URL: 'https://nemanjamitic.com'
16+
PLAUSIBLE_SCRIPT_URL: 'https://plausible.arm1.nemanjamitic.com/js/script.js'
1617
SSH_ALIAS: arm1
1718

1819
jobs:

.github/workflows/default__build-push-docker.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ on:
1414
env:
1515
IMAGE_NAME: ${{ github.event.repository.name }}
1616
SITE_URL: 'https://nmc-docker.arm1.nemanjamitic.com'
17+
PLAUSIBLE_SCRIPT_URL: 'https://plausible.arm1.nemanjamitic.com/js/script.js'
1718

1819
jobs:
1920
build:

.github/workflows/default__deploy-nginx.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ on:
1313

1414
env:
1515
SITE_URL: 'https://nemanjamitic.com'
16+
PLAUSIBLE_SCRIPT_URL: 'https://plausible.arm1.nemanjamitic.com/js/script.js'
1617

1718
jobs:
1819
deploy:

.github/workflows/gh-pages__deploy-astro.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ permissions:
2323
# set env vars in Github settings here
2424
env:
2525
SITE_URL: 'https://nemanjam.github.io'
26+
PLAUSIBLE_SCRIPT_URL: 'https://plausible.arm1.nemanjamitic.com/js/script.js'
2627

2728
jobs:
2829
# build with astro action, unusable for monorepo

.github/workflows/gh-pages__deploy-manual.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ permissions:
2020
# set env vars in Github settings here
2121
env:
2222
SITE_URL: 'https://nemanjam.github.io'
23+
PLAUSIBLE_SCRIPT_URL: 'https://plausible.arm1.nemanjamitic.com/js/script.js'
2324

2425
jobs:
2526
build-manual:

astro.config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import mdx from '@astrojs/mdx';
2+
import partytown from '@astrojs/partytown';
23
import react from '@astrojs/react';
34
import tailwind from '@astrojs/tailwind';
45
import icon from 'astro-icon';
@@ -32,6 +33,9 @@ export default defineConfig({
3233
// applyBaseStyles: false prevents double loading of tailwind
3334
tailwind({ applyBaseStyles: false }),
3435
icon({ iconDir: 'src/assets/icons' }),
36+
partytown({
37+
config: { forward: ['dataLayer.push'] },
38+
}),
3539
],
3640
markdown: { remarkPlugins },
3741
vite: {

docker/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ ARG ARG_SITE_URL
2525
ENV SITE_URL=$ARG_SITE_URL
2626
RUN echo "SITE_URL=$SITE_URL"
2727

28+
ARG ARG_PLAUSIBLE_SCRIPT_URL
29+
ENV PLAUSIBLE_SCRIPT_URL=$ARG_PLAUSIBLE_SCRIPT_URL
30+
RUN echo "PLAUSIBLE_SCRIPT_URL=$PLAUSIBLE_SCRIPT_URL"
31+
2832
RUN yarn build
2933

3034
FROM nginx:stable-alpine3.17-slim AS runtime

docs/working-notes/todo3.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,5 +525,10 @@ fix image sizes for gallery and other
525525
-----
526526
gallery scroll pagination, blur loading
527527
odvojen ARG_SITE_URL za x86 i arm
528+
folder name for slug and index.mdx and images
529+
530+
// plausible
531+
<script defer data-domain="nemanjamitic.com" src="https://plausible.arm1.nemanjamitic.com/js/script.js"></script>
532+
add zod schema that checks node_env for plausible_url instead of optional
528533
------------
529534
```

0 commit comments

Comments
 (0)