sapper-google-analytics

1.0.2 • Public • Published

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 {storesid={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> 

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i sapper-google-analytics

      Weekly Downloads

      5

      Version

      1.0.2

      License

      MIT

      Unpacked Size

      2.98 kB

      Total Files

      4

      Last publish

      Collaborators

      • imbolc