Skip to content

Commit

Permalink
fix(typescript): event type definitions (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
namoscato committed Feb 5, 2020
1 parent 9040a78 commit de619c0
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions vue-gtag.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@ declare module 'vue-gtag' {
page_path: string;
}

export interface Event {
event_category: string;
event_label: string;
value: string;
export interface EventParams {
/** string that will appear as the event category */
event_category?: string;
/** string that will appear as the event label */
event_label?: string;
/** non-negative integer that will appear as the event value */
value?: number;
[key: string]: any;
}

export interface ScreenView {
Expand All @@ -38,7 +42,16 @@ declare module 'vue-gtag' {

export interface VueGtag {
pageview(pageView: PageView): void;
event(action: string, event: Event): void;

/**
* Send a Google Analytics Event.
*
* @see https://developers.google.com/analytics/devguides/collection/gtagjs/events
*
* @param action string that will appear as the event action in Google Analytics Event reports
* @param eventParams
*/
event(action: string, eventParams?: EventParams): void;
screenview(screenView: ScreenView): void;
customMap(map: Dictionary<string>): void;
purchase(purchase: Purchase): void;
Expand Down

0 comments on commit de619c0

Please sign in to comment.