Remove analytics

This commit is contained in:
Konrad Szwarc 2023-01-28 01:01:51 +01:00
parent 0698d62a63
commit 47b54c5521
10 changed files with 36 additions and 133 deletions

View file

@ -47,9 +47,40 @@ jobs:
- name: Run Astro check - name: Run Astro check
run: npm run astro:check run: npm run astro:check
deploy:
name: Deploy to Netlify
needs: [prettier, typescript, astro]
if: github.repository == 'KonradSzwarc/devscard'
runs-on: ubuntu-latest
outputs:
deploy-url: ${{ steps.netlify.outputs.deploy-url }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
cache: npm
- name: Install dependencies
run: npm ci
- name: Run Astro build command
run: npm run build
- name: Deploy to Netlify
id: netlify
uses: nwtgck/actions-netlify@v2
with:
publish-dir: dist
production-branch: main
github-token: ${{ secrets.GITHUB_TOKEN }}
production-deploy: true
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
timeout-minutes: 1
percy: percy:
name: Run Percy check name: Run Percy check
if: github.repository == 'KonradSzwarc/devscard' if: github.repository == 'KonradSzwarc/devscard'
needs: deploy
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
@ -68,39 +99,6 @@ jobs:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }} PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
run: npx percy snapshot dist/ run: npx percy snapshot dist/
deploy:
name: Deploy to Netlify
needs: [prettier, typescript, astro]
if: github.repository == 'KonradSzwarc/devscard'
runs-on: ubuntu-latest
outputs:
deploy-url: ${{ steps.netlify.outputs.deploy-url }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
cache: npm
- name: Install dependencies
run: npm ci
- name: Run Astro build command
run: npm run build
env:
PUBLIC_GA_MEASUREMENT_ID: ${{ secrets.PUBLIC_GA_MEASUREMENT_ID }}
PUBLIC_CLARITY_PROJECT_ID: ${{ secrets.PUBLIC_CLARITY_PROJECT_ID }}
- name: Deploy to Netlify
id: netlify
uses: nwtgck/actions-netlify@v2
with:
publish-dir: dist
production-branch: main
github-token: ${{ secrets.GITHUB_TOKEN }}
production-deploy: true
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
timeout-minutes: 1
lighthouse: lighthouse:
name: Run Lighthouse check name: Run Lighthouse check
if: github.repository == 'KonradSzwarc/devscard' if: github.repository == 'KonradSzwarc/devscard'

View file

@ -12,7 +12,6 @@ A fully customizable template you can use to create your online (and paper) resu
- **🔶 Built-in icon sets** — choose from over 100 000 [Iconify](https://iconify.design/) icons to represent your skills. - **🔶 Built-in icon sets** — choose from over 100 000 [Iconify](https://iconify.design/) icons to represent your skills.
- **🌍 I18n** — customize your resume's locale, date formatting, and used translations. - **🌍 I18n** — customize your resume's locale, date formatting, and used translations.
- **🔎 SEO friendly** — the entire website is designed with SEO in mind. All SEO-related config properties are required and well-described. - **🔎 SEO friendly** — the entire website is designed with SEO in mind. All SEO-related config properties are required and well-described.
- **📊 Analytics** — built-in support for [Google Analytics](https://analytics.google.com/) and [Clarity](https://clarity.microsoft.com/). The only you need to do is provide their IDs.
- **🏭 Favicons generation** — invoke one command to generate all favicons and full app manifest for your website. - **🏭 Favicons generation** — invoke one command to generate all favicons and full app manifest for your website.
- **🛠 Data helpers** — use built-in helpers to define your skills/socials once and reuse them across the configuration. - **🛠 Data helpers** — use built-in helpers to define your skills/socials once and reuse them across the configuration.
- **🔀 Data transformers** — utilize type-safe data transformers to create multiple variants of your resume without duplicating your data. - **🔀 Data transformers** — utilize type-safe data transformers to create multiple variants of your resume without duplicating your data.

View file

@ -1,18 +1,12 @@
import image from '@astrojs/image'; import image from '@astrojs/image';
import tailwind from '@astrojs/tailwind'; import tailwind from '@astrojs/tailwind';
import partytown from '@astrojs/partytown';
import compress from 'astro-compress'; import compress from 'astro-compress';
import { defineConfig } from 'astro/config'; import { defineConfig } from 'astro/config';
import { visualizer } from 'rollup-plugin-visualizer'; import { visualizer } from 'rollup-plugin-visualizer';
// https://astro.build/config // https://astro.build/config
export default defineConfig({ export default defineConfig({
integrations: [ integrations: [tailwind(), image(), compress()],
tailwind(),
image(),
compress(),
partytown({ config: { forward: ['dataLayer.push', 'clarity.push'] } }),
],
vite: { vite: {
plugins: [visualizer()], plugins: [visualizer()],
resolve: { resolve: {

36
package-lock.json generated
View file

@ -14,7 +14,6 @@
}, },
"devDependencies": { "devDependencies": {
"@astrojs/image": "0.12.1", "@astrojs/image": "0.12.1",
"@astrojs/partytown": "1.0.2",
"@astrojs/react": "1.2.2", "@astrojs/react": "1.2.2",
"@astrojs/tailwind": "2.1.3", "@astrojs/tailwind": "2.1.3",
"@percy/cli": "1.17.0", "@percy/cli": "1.17.0",
@ -162,16 +161,6 @@
"vfile-message": "^3.0.0" "vfile-message": "^3.0.0"
} }
}, },
"node_modules/@astrojs/partytown": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@astrojs/partytown/-/partytown-1.0.2.tgz",
"integrity": "sha512-+pUjLxdp0SYqUO+X+FjFN95KxK7w4Rs5gIMQ7scKUWd2073D3/5hTlij9qNmX5Bk/tFHUfTivKIZ5p233Lpa9Q==",
"dev": true,
"dependencies": {
"@builder.io/partytown": "^0.7.1",
"mrmime": "^1.0.0"
}
},
"node_modules/@astrojs/prism": { "node_modules/@astrojs/prism": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/@astrojs/prism/-/prism-1.0.1.tgz", "resolved": "https://registry.npmjs.org/@astrojs/prism/-/prism-1.0.1.tgz",
@ -603,15 +592,6 @@
"node": ">=6.9.0" "node": ">=6.9.0"
} }
}, },
"node_modules/@builder.io/partytown": {
"version": "0.7.5",
"resolved": "https://registry.npmjs.org/@builder.io/partytown/-/partytown-0.7.5.tgz",
"integrity": "sha512-Zbr2Eo0AQ4yzmQr/36/h+6LKjmdVBB3Q5cGzO6rtlIKB/IOpbQVUZW+XAnhpJmJr9sIF97OZjgbhG9k7Sjn4yw==",
"dev": true,
"bin": {
"partytown": "bin/partytown.cjs"
}
},
"node_modules/@cspotcode/source-map-support": { "node_modules/@cspotcode/source-map-support": {
"version": "0.8.1", "version": "0.8.1",
"resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz",
@ -9771,16 +9751,6 @@
"vfile-message": "^3.0.0" "vfile-message": "^3.0.0"
} }
}, },
"@astrojs/partytown": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@astrojs/partytown/-/partytown-1.0.2.tgz",
"integrity": "sha512-+pUjLxdp0SYqUO+X+FjFN95KxK7w4Rs5gIMQ7scKUWd2073D3/5hTlij9qNmX5Bk/tFHUfTivKIZ5p233Lpa9Q==",
"dev": true,
"requires": {
"@builder.io/partytown": "^0.7.1",
"mrmime": "^1.0.0"
}
},
"@astrojs/prism": { "@astrojs/prism": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/@astrojs/prism/-/prism-1.0.1.tgz", "resolved": "https://registry.npmjs.org/@astrojs/prism/-/prism-1.0.1.tgz",
@ -10102,12 +10072,6 @@
"to-fast-properties": "^2.0.0" "to-fast-properties": "^2.0.0"
} }
}, },
"@builder.io/partytown": {
"version": "0.7.5",
"resolved": "https://registry.npmjs.org/@builder.io/partytown/-/partytown-0.7.5.tgz",
"integrity": "sha512-Zbr2Eo0AQ4yzmQr/36/h+6LKjmdVBB3Q5cGzO6rtlIKB/IOpbQVUZW+XAnhpJmJr9sIF97OZjgbhG9k7Sjn4yw==",
"dev": true
},
"@cspotcode/source-map-support": { "@cspotcode/source-map-support": {
"version": "0.8.1", "version": "0.8.1",
"resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz",

View file

@ -28,7 +28,6 @@
}, },
"devDependencies": { "devDependencies": {
"@astrojs/image": "0.12.1", "@astrojs/image": "0.12.1",
"@astrojs/partytown": "1.0.2",
"@astrojs/react": "1.2.2", "@astrojs/react": "1.2.2",
"@astrojs/tailwind": "2.1.3", "@astrojs/tailwind": "2.1.3",
"@percy/cli": "1.17.0", "@percy/cli": "1.17.0",

View file

@ -1,10 +0,0 @@
---
import Clarity from './clarity.astro';
import GoogleAnalytics from './google-analytics.astro';
const GA_MEASUREMENT_ID = import.meta.env.PUBLIC_GA_MEASUREMENT_ID;
const CLARITY_PROJECT_ID = import.meta.env.PUBLIC_CLARITY_PROJECT_ID;
---
{GA_MEASUREMENT_ID && <GoogleAnalytics id={GA_MEASUREMENT_ID} />}
{CLARITY_PROJECT_ID && <Clarity id={CLARITY_PROJECT_ID} />}

View file

@ -1,22 +0,0 @@
---
export interface Props {
id: string;
}
const { id } = Astro.props;
---
<script type="text/partytown" define:vars={{ id }}>
(function (c, l, a, r, i, t, y) {
c[a] =
c[a] ||
function () {
(c[a].q = c[a].q || []).push(arguments);
};
t = l.createElement(r);
t.async = 1;
t.src = 'https://www.clarity.ms/tag/' + i;
y = l.getElementsByTagName(r)[0];
y.parentNode.insertBefore(t, y);
})(window, document, 'clarity', 'script', id);
</script>

View file

@ -1,17 +0,0 @@
---
export interface Props {
id: string;
}
const { id } = Astro.props;
---
<script type="text/partytown" src={`https://www.googletagmanager.com/gtag/js?id=${id}`}></script>
<script type="text/partytown" define:vars={{ id }}>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', id);
</script>

View file

@ -1,7 +1,6 @@
--- ---
import type { Data } from '@/types/data'; import type { Data } from '@/types/data';
import Analytics from '@/web/analytics/analytics.astro'; import Head from '@/web/head/head.astro';
import Head from './head.astro';
export interface Props extends Pick<Data['config'], 'meta' | 'i18n'> {} export interface Props extends Pick<Data['config'], 'meta' | 'i18n'> {}
@ -12,7 +11,6 @@ const { meta, i18n } = Astro.props;
<html lang={i18n.locale.code} class="scroll-smooth"> <html lang={i18n.locale.code} class="scroll-smooth">
<Head meta={meta} /> <Head meta={meta} />
<body class="flex justify-center overflow-x-hidden bg-gray-50 dark:bg-gray-900 xl:relative xl:left-7"> <body class="flex justify-center overflow-x-hidden bg-gray-50 dark:bg-gray-900 xl:relative xl:left-7">
<Analytics />
<slot /> <slot />
</body> </body>
</html> </html>

View file

@ -1,9 +1,9 @@
--- ---
import Fonts from '@/components/fonts.astro'; import Fonts from '@/components/fonts.astro';
import Favicons from '@/web/head/favicons.auto-generated.astro';
import InitialTheme from '@/web/head/initial-theme.astro';
import Meta from '@/web/head/meta.astro';
import type { MetaConfig } from '@/types/config/meta-config.types'; import type { MetaConfig } from '@/types/config/meta-config.types';
import Favicons from './favicons.auto-generated.astro';
import InitialTheme from './initial-theme.astro';
import Meta from './meta.astro';
interface Props { interface Props {
meta: MetaConfig; meta: MetaConfig;