1.0.7 • Published 3 years ago

svelte-track-outboundlink v1.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

svelte-track-outboundlink

Commitizen friendly TypeScript

Svelte component for tracking outbound links in analytics.

Currently works with Google Tag Manager (gtag.js). Package assumes that you have already installed gtag.js.

Install

npm i svelte-track-outboundlink -D

The OutboundLink component will be output as an anchor tag. When clicked it will fire a gtag.js event with the following properties:

  • Action: click
  • Category: outbound
  • Label: the href prop value
  • Transport type: beacon

Usage

Import the component and use it in place of an anchor tag when linking to external pages:

<script>
  import OutboundLink from "svelte-track-outboundlink";
</script>

<OutboundLink href="https://www.example.com/" class="example">Example Link</OutboundLink>

The following props are available:

NameTypeDefaultExample
hrefstringjavascript:void(0);https://www.exmaple.com
targetstringundefined_blank
relstringundefinednoreferrer
1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago