Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

Commit

Permalink
Merge branch 'master' of github.com:MatteoGabriele/vue-analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
MatteoGabriele committed Jan 6, 2020
2 parents 125462f + 02beb00 commit f03818d
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 39 deletions.
34 changes: 16 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
> :warning: **This plugin will stop receiving feature requests. I will only spend time for important bug fixes**. Google moved from analytics.js to its new gtag.js library and I've created a new plugin called [vue-gtag](https://github.com/MatteoGabriele/vue-gtag). I suggest you to start using that one if you are about to create a new project.
<p align="center">
<img src="http://i.imgur.com/whvHAT6.png" width="180" />
<br>
<br>
<a href="https://badge.fury.io/js/vue-analytics">
<img src="https://badge.fury.io/js/vue-analytics.svg" />
<a/>

<a href="https://www.npmjs.com/package/vue-analytics">
<img src="https://img.shields.io/npm/dm/vue-analytics.svg" />
<a/>

<a href="https://travis-ci.org/MatteoGabriele/vue-analytics">
<img src="https://travis-ci.org/MatteoGabriele/vue-analytics.svg?branch=master" />
</a>

<img src="https://img.shields.io/badge/size-4kB-brightgreen.svg" />
<img width="180" src="http://i.imgur.com/whvHAT6.png">
<br>
<br>
<a href="https://npm.im/vue-analytics">
<img src="https://badgen.net/npm/v/vue-analytics">
</a>
<a href="https://npm.im/vue-analytics">
<img src="https://badgen.net/npm/dm/vue-analytics">
</a>
<a href="https://travis-ci.org/MatteoGabriele/vue-analytics">
<img src="https://badgen.net/travis/MatteoGabriele/vue-analytics/master">
</a>
<a href="https://bundlephobia.com/result?p=vue-analytics">
<img src="https://badgen.net/bundlephobia/minzip/vue-analytics">
</a>
</p>

# vue-analytics

Vue plugin for Google Analytics


## Why should I use it?

The plugin isn't just a wrapper of the Google Analytics API, but provides a solution to issues that most of the time you don't want to deal with or you not even know you have to deal with.
Expand All @@ -45,6 +43,7 @@ For example:
Vue ^2.0.0

## Articles

[Google Analytics, GDPR and Vuejs](https://medium.com/@matteo_gabriele/google-analytics-gdpr-and-vuejs-e1bd6affd2b4)

[Vuejs and Google Analytics](https://medium.com/@matteo_gabriele/vuejs-and-google-analytics-689a07e00116)
Expand Down Expand Up @@ -84,7 +83,6 @@ npm install vue-analytics
* [Custom analytics.js URL](/docs/custom-analytics.md)
* [Debug](/docs/debug.md)


# Issues and features requests

Please drop an issue, if you find something that doesn't work, or a feature request at [https://github.com/MatteoGabriele/vue-analytics/issues](https://github.com/MatteoGabriele/vue-analytics/issues)
Expand Down
50 changes: 29 additions & 21 deletions vue-analytics.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ declare module 'vue-analytics' {
import VueRouter, { Route } from 'vue-router';
import { Store } from 'vuex';

interface EventPayload {
eventCategory: string;
eventAction?: string;
eventLabel?: string;
eventValue?: number;
}

interface eventFn {
(category: string, action?: string, label?: string, value?: number): void;
(options: {
eventCategory: string,
eventAction?: string,
eventLabel?: string,
eventValue?: number
}): void;
(options: EventPayload): void;
}

type pageDetails = {
Expand All @@ -36,23 +38,27 @@ declare module 'vue-analytics' {
(options: Record<string, any>): void;
}

interface SocialPayload {
socialNetwork: string;
socialAction: string;
socialTarget: string;
}

interface socialFn {
(network: string, action: string, target: string): void;
(options: {
socialNetwork: string,
socialAction: string,
socialTarget: string
}): void;
(options: SocialPayload): void;
}

interface TimePayload {
timingCategory: string;
timingVar: string;
timingValue: number;
timingLabel: string;
}

interface timeFn {
(category: string, variable: string, value: number, label: string): void;
(options: {
timingCategory: string,
timingVar: string,
timingValue: number,
timingLabel: string
}): void;
(options: TimePayload): void;
}

interface EcommerceItem {
Expand Down Expand Up @@ -159,12 +165,14 @@ declare module 'vue-analytics' {
send(): void;
}

interface ScreenViewPayload {
screenName: string;
[otherProperties: string]: any;
}

interface screenviewFn {
(screen: string) :void;
(option: {
screenName: string;
[otherProperties: string]: any;
}): void;
(option: ScreenViewPayload): void;
}

interface requireFn {
Expand Down

0 comments on commit f03818d

Please sign in to comment.