Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

imbolc/sapper-google-analytics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

6 Commits

Repository files navigation

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:

npm i sapper-google-analytics

And add it to your src/routes/_layout.svelte:

<GoogleAnalytics {stores} id={ga_measurment_id}/>
<script>
 import GoogleAnalytics from "sapper-google-analytics/GoogleAnalytics.svelte"
 import { stores } from "@sapper/app"
 let ga_measurment_id = "UA-SOMETHING" // your analytics id
</script>

Packages

No packages published

Contributors 2

Languages

AltStyle によって変換されたページ (->オリジナル) /