Skip to content
This repository was archived by the owner on Mar 21, 2025. It is now read-only.

Commit 1758db6

Browse files
feat: exports all library
adds possibility to access the vue-analytics library from outside the Vue scope closes #151
1 parent bad42a0 commit 1758db6

File tree

1 file changed

+23
-10
lines changed

1 file changed

+23
-10
lines changed

src/index.js

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,37 @@
11
import bootstrap from './bootstrap'
22
import lib from './lib'
33
import { update } from './config'
4-
import { onAnalyticsReady } from './helpers'
4+
import * as helpers from './helpers'
55
import ga from 'directives/ga'
6-
import * as exception from 'lib/exception'
7-
import analyticsMiddleware from './vuex-middleware'
6+
import { autotracking as expectionAutotracking } from 'lib/exception'
7+
import vuexMiddleware from './vuex-middleware'
88

99
export default function install (Vue, options = {}) {
1010
update({ ...options, $vue: Vue })
1111

1212
Vue.directive('ga', ga)
13-
1413
Vue.prototype.$ga = Vue.$ga = lib
1514

16-
exception.autotracking(Vue)
17-
15+
expectionAutotracking(Vue)
1816
bootstrap()
1917
}
2018

21-
export {
22-
onAnalyticsReady,
23-
analyticsMiddleware
24-
}
19+
// Vuex middleware
20+
export const analyticsMiddleware = vuexMiddleware
21+
22+
// Helpers
23+
export const onAnalyticsReady = helpers.onAnalyticsReady
24+
25+
// Event library
26+
export const event = lib.event
27+
export const ecommerce = lib.ecommerce
28+
export const set = lib.set
29+
export const page = lib.page
30+
export const query = lib.query
31+
export const screenview = lib.screenview
32+
export const time = lib.time
33+
export const require = lib.require
34+
export const exception = lib.exception
35+
export const social = lib.social
36+
37+

0 commit comments

Comments
 (0)