0.1.4 • Published 4 years ago

@dexlib/svelte-matomo v0.1.4

Weekly downloads
70
License
MIT
Repository
gitlab
Last release
4 years ago

svelte-matomo component

This component loads the matomo script and exposes an asynchronous matomo api.

Usage in svelte

<script>
  import { onMount } from 'svelte'
  import Matomo, { matomo } from '@dexlib/svelte-matomo'

  const url = '<matomo-url>'
  const siteId = 0

  onMount(() => {
    matomo.trackPageView()
  })
</script>

<Matomo {url} {siteId} />

Usage in sapper

Is very similar, but set it up in your most upper _layout.svelte page component. You can use the page store for reacting to page changes:

  • _layout.html *
<script>
  import { stores } from '@sapper/app'
  import Matomo, { matomo } from '@dexlib/svelte-matomo'

  const { page } = stores()

  const url = '<matomo-url>'
  const siteId = 0
  
  $: if ($page) matomo.trackPageView()

  onMount(() => {
    matomo.trackPageView()
  })
</script>

<Matomo {url} {siteId} />

Use the matomo api for further reference.

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago