Skip to content
This repository was archived by the owner on Feb 20, 2025. It is now read-only.
/ vue-segment Public archive

Vue.js plugin for Segment Analytics.js

License

Notifications You must be signed in to change notification settings

dansmaculotte/vue-segment

Folders and files

NameName
Last commit message
Last commit date
Apr 21, 2020
Jan 13, 2020
May 3, 2019
May 3, 2019
Jul 18, 2019
May 3, 2019
Apr 21, 2020
May 3, 2019
Aug 20, 2021
May 3, 2019
May 3, 2019
May 3, 2019
May 3, 2019
Oct 24, 2024
Feb 20, 2025

Repository files navigation

NOT MAINTAINED ANYMORE!

We don't use segment anymore for our website, I don't have an account on Segment to make this plugin evolve.

Please fill in an issue if you want to be a maintainer or if you want redirect people to you fork.

vue-segment

npm version npm downloads Dependencies Standard JS

Vue.js plugin for Segment Analytics.js

Segment Analytics.js Documentation

Setup

  1. Add the @dansmaculotte/vue-segment dependency with yarn or npm to your project
  2. Configure it:
import Vue from 'vue'
import Segment from '@dansmaculotte/vue-segment'

Vue.use(Segment, {
  writeKey: 'YOUR_SEGMENT_WRITE_KEY',
  disabled: true,
  router,
  pageCategory: 'shop',
  settings: {
    ...
  }
})

Usage

See Segment Vue Quickstart Guide.

Options

writeKey

  • Type: String
    • Default: ''

disabled

Disable automatic script loading, if you need compliance with GDPR.

  • Type: Boolean
    • Default: false

router

Call analytics.page method on afterEach router method if provided.

  • Type: Object

pageCategory

In case you provided router, you can specify the category page of the page event. See segment page method reference.

  • Type: String,
    • Default: ''

settings

See Load options reference.

  • Type: Object

Development

  1. Clone this repository
  2. Install dependencies using yarn install or npm install
  3. Start development server using npm run dev

License

MIT License