Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/imbolc/sapper-google-analytics
Google Analytics for Sapper (Svelte)
https://github.com/imbolc/sapper-google-analytics
analy analytics google-analytics sapper sapperjs svelte svelte-js svelte-v3 svelte3
Last synced: 4 months ago
JSON representation
Google Analytics for Sapper (Svelte)
- Host: GitHub
- URL: https://github.com/imbolc/sapper-google-analytics
- Owner: imbolc
- License: mit
- Created: 2020-02-07T10:01:21.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-07-28T11:18:28.000Z (over 4 years ago)
- Last Synced: 2024-09-29T12:01:49.806Z (4 months ago)
- Topics: analy, analytics, google-analytics, sapper, sapperjs, svelte, svelte-js, svelte-v3, svelte3
- Language: HTML
- Size: 3.91 KB
- Stars: 34
- Watchers: 5
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Google Analytics tracking for Sapper-based apps
It's not enough to just add Analytics code for SPA sites,
as it doesn't track client-side navigation. So we
have to pass navigation events manually and this component
does exactly this.# Setup
Install the component:
```sh
npm i sapper-google-analytics
```And add it to your `src/routes/_layout.svelte`:
```html
import GoogleAnalytics from "sapper-google-analytics/GoogleAnalytics.svelte"
import { stores } from "@sapper/app"let ga_measurment_id = "UA-SOMETHING" // your analytics id
```