Skip to content

Commit

Permalink
feat: update analytics for the astro-simpleanalytics-plugin usage
Browse files Browse the repository at this point in the history
  • Loading branch information
ViorelMocanu committed Oct 30, 2023
1 parent 86bb42d commit 0fe9628
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 28 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"@astrojs/rss": "3.0.0",
"@astrojs/sitemap": "3.0.2",
"astro": "3.4.0",
"astro-simpleanalytics-plugin": "0.1.4",
"astro-simpleanalytics-plugin": "0.3.3",
"astro-webmanifest": "1.0.0",
"lite-youtube-embed": "0.3.0",
"sass": "1.69.5",
Expand Down
38 changes: 19 additions & 19 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 16 additions & 6 deletions src/components/Analytics.astro
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,29 @@
*/
import { CLARITY_ID, ENV, PIWIK_ID } from '../config';
import { SimpleAnalytics } from 'astro-simpleanalytics-plugin';
// @TODO: analyze whether we need light or latest SA script: https://docs.simpleanalytics.com/light
---

<SimpleAnalytics
debug={false}
allEnvironments={true}
partytown={false}
light={false}
collectDNT={true}
strictUTMs={false}
allowParams={undefined}
customHostname={undefined}
customDomain={undefined}
ignorePages={undefined}
nonUniqueHostnames="fastspring.com,stripe.com"
ignoreMetrics={undefined}
/>

{(ENV !== 'local' && ENV !== 'development') && (
<div class="Information">
{/*
<script is:inline async defer src="https://scripts.simpleanalyticscdn.com/latest.js"></script>
<noscript>
<img src="https://queue.simpleanalyticscdn.com/noscript.gif" alt="" referrerpolicy="no-referrer-when-downgrade" />
</noscript>
*/}

<script is:inline define:vars={{ CLARITY_ID }} async defer type="text/partytown">
(function (c, l, a, r, i, t, y) {
Expand Down
2 changes: 0 additions & 2 deletions src/layouts/Layout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ import {
import Analytics from '../components/Analytics.astro';
import Footer from '../components/Footer.astro';
import Header from '../components/Header.astro';
import { SimpleAnalytics } from 'astro-simpleanalytics-plugin';
import { ViewTransitions } from 'astro:transitions';
interface Props {
Expand Down Expand Up @@ -122,6 +121,5 @@ const { title = SITE_TITLE, description = SITE_DESCRIPTION, ogImage = OG_IMAGE,
<p class="TemporaryMessage">Template: <strong>{template}</strong> built at <em>{buildDate}</em> on ENV = <strong>{ENV}</strong>.</p>
</div>
<Analytics />
<SimpleAnalytics debug={false} partytown={false} allEnvironments={true} />
</body>
</html>

0 comments on commit 0fe9628

Please sign in to comment.