Skip to content
This repository has been archived by the owner on Feb 11, 2022. It is now read-only.

maxpaj/vue-keen-tracking

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

28 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

npm badge

Vue plugin built on keen-tracking.js.

Install

npm install vue-keen-tracking --save
import VueKeen from "vue-keen-tracking";

const options = {
  projectId: "<KEEN_PROJECT_ID>",
  writeKey: "<KEEN_WRITE_KEY>"
};

Vue.use(VueKeen, options);

You can then access the KeenTracking object through this.$keen in any of your components/views.

Auto tracking

You can add autoTracking: { ... } to configure Keens auto-tracking.

const options = {
  projectId: "<KEEN_PROJECT_ID>",
  writeKey: "<KEEN_WRITE_KEY>",
  autoTracking: { 
    recordPageViews: true,
    ...
  }
};

Vue-Router and Vuex

To track events from vue-router or vuex, extend your config with this:

import VueRouter from "vue-router";
import Vuex from "vuex";

Vue.use(Vuex);
Vue.use(VueRouter);

const router = require("./router");
const store = require("./store");

const options = {
  projectId: "<KEEN_PROJECT_ID>",
  writeKey: "<KEEN_WRITE_KEY>",
  trackRoutes: {
    router: router
  },
  trackVuex: {
    store: store,
    mutations: true,
    actions: true
  }
};

Extend event properties

API reference

const user = await fetchUser();
this.$keen.extendEvents({ user })

Record an event

API reference

this.$keen.recordEvent("purchases", {
  item: "avocado"
});

About

๐Ÿ“ˆ Vue plugin for Keen.io tracking.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published