Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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)

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

```