Comparing version 1.5.0 to 1.6.0
{ | ||
"name": "vue-gtag", | ||
"description": "Global Site Tag (gtag.js) plugin for Vue", | ||
"version": "1.5.0", | ||
"version": "1.6.0", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Matteo Gabriele", |
@@ -1,5 +0,97 @@ | ||
declare module 'vue-gtag' { | ||
import _Vue, { PluginFunction } from 'vue'; | ||
import VueRouter from 'vue-router'; | ||
declare module "vue-gtag" { | ||
import VueRouter from "vue-router"; | ||
import _Vue, { PluginFunction } from "vue"; | ||
type Currency = string | number; | ||
type EventNames = | ||
| "add_payment_info" | ||
| "add_to_cart" | ||
| "add_to_wishlist" | ||
| "begin_checkout" | ||
| "checkout_progress" | ||
| "exception" | ||
| "generate_lead" | ||
| "login" | ||
| "page_view" | ||
| "purchase" | ||
| "refund" | ||
| "remove_from_cart" | ||
| "screen_view" | ||
| "search" | ||
| "select_content" | ||
| "set_checkout_option" | ||
| "share" | ||
| "sign_up" | ||
| "timing_complete" | ||
| "view_item" | ||
| "view_item_list" | ||
| "view_promotion" | ||
| "view_search_results"; | ||
interface GtagPromotion { | ||
creative_name?: string; | ||
creative_slot?: string; | ||
id?: string; | ||
name?: string; | ||
} | ||
interface GtagItem { | ||
brand?: string; | ||
category?: string; | ||
creative_name?: string; | ||
creative_slot?: string; | ||
id?: string; | ||
location_id?: string; | ||
name?: string; | ||
price?: Currency; | ||
quantity?: number; | ||
} | ||
type GtagControlParams = { | ||
groups?: string | string[]; | ||
send_to?: string | string[]; | ||
event_callback?: () => void; | ||
event_timeout?: number; | ||
}; | ||
type GtagEventParams = { | ||
checkout_option?: string; | ||
checkout_step?: number; | ||
content_id?: string; | ||
content_type?: string; | ||
coupon?: string; | ||
currency?: string; | ||
description?: string; | ||
fatal?: boolean; | ||
items?: GtagItem[]; | ||
method?: string; | ||
number?: string; | ||
promotions?: GtagPromotion[]; | ||
screen_name?: string; | ||
search_term?: string; | ||
shipping?: Currency; | ||
tax?: Currency; | ||
transaction_id?: string; | ||
value?: number; | ||
event_label?: string; | ||
event_category?: string; | ||
}; | ||
interface CustomParams { | ||
[key: string]: any; | ||
} | ||
interface Gtag { | ||
( | ||
command: "config", | ||
targetId: string, | ||
config?: GtagControlParams | GtagEventParams | CustomParams | ||
): void; | ||
(command: "set", config: CustomParams): void; | ||
(command: "js", config: Date): void; | ||
( | ||
command: "event", | ||
eventName: EventNames | string, | ||
eventParams?: GtagControlParams | GtagEventParams | CustomParams | ||
): void; | ||
} | ||
type GtagGenericParams = GtagControlParams | GtagEventParams | CustomParams; | ||
export interface PageView { | ||
@@ -11,10 +103,6 @@ page_title: 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 Event extends GtagEventParams { | ||
event_category: string; | ||
event_label: string; | ||
value: number; | ||
} | ||
@@ -29,4 +117,9 @@ | ||
transaction_id: string; | ||
affiliation: string; | ||
value: number; | ||
affiliation?: string; | ||
value?: number; | ||
tax?: number; | ||
shipping?: number; | ||
items?: GtagItem[]; | ||
checkout_step?: number; | ||
checkout_option?: string; | ||
} | ||
@@ -42,2 +135,5 @@ | ||
domains: string[]; | ||
decorate_forms?: boolean; | ||
accept_incoming?: boolean; | ||
url_position?: "fragment" | "query"; | ||
} | ||
@@ -50,7 +146,15 @@ | ||
export interface Timing { | ||
name: string; | ||
value: number; | ||
event_category?: string; | ||
event_label?: string; | ||
} | ||
export type Dictionary<T> = { [key: string]: T }; | ||
export interface VueGtag { | ||
optIn(): void; | ||
optOut(): void; | ||
pageview(pageView: PageView): void; | ||
/** | ||
@@ -62,7 +166,8 @@ * Send a Google Analytics Event. | ||
* @param action string that will appear as the event action in Google Analytics Event reports | ||
* @param eventParams | ||
* @param event | ||
*/ | ||
event(action: string, eventParams?: EventParams): void; | ||
event(action: EventNames | string, event: Event): void; | ||
screenview(screenView: ScreenView): void; | ||
customMap(map: Dictionary<string>): void; | ||
purchase(puchase: Event): void; | ||
purchase(purchase: Purchase): void; | ||
@@ -72,7 +177,15 @@ refund(refund: Refund): void; | ||
exception(ex: Exception): void; | ||
set(config: CustomParams): void; | ||
config(config?: GtagGenericParams); | ||
time(timing: Timing); | ||
} | ||
export interface DomainConfig { | ||
id: string; | ||
params?: GtagGenericParams & { send_page_view: boolean }; | ||
} | ||
export interface PluginOptions { | ||
appName?: string; | ||
pageTrackerTemplate?: () => void; | ||
pageTrackerTemplate?: () => PageView; | ||
onBeforeTrack?: () => void; | ||
@@ -88,16 +201,20 @@ onAfterTrack?: () => void; | ||
defaultGroupName?: string; | ||
includes?: any; | ||
config?: { | ||
id: string, | ||
params?: Dictionary<any> | ||
}; | ||
includes?: DomainConfig[]; | ||
config?: DomainConfig; | ||
} | ||
export class VueGtagPlugin { | ||
static install(Vue: typeof _Vue, options: PluginOptions, router?: VueRouter): void; | ||
static install( | ||
Vue: typeof _Vue, | ||
options: PluginOptions, | ||
router?: VueRouter | ||
): void; | ||
} | ||
export function bootstrap(): Promise<Gtag>; | ||
export function setOptions(PluginOptions): void; | ||
export default VueGtagPlugin; | ||
module 'vue/types/vue' { | ||
module "vue/types/vue" { | ||
interface Vue { | ||
@@ -104,0 +221,0 @@ $gtag: VueGtag; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
65232
1369