@deptno/gtag
Version:
gtag, typescript
199 lines (198 loc) • 5.92 kB
TypeScript
export declare const gtag: GTag;
export declare type GTag = {
(command: Command, config?: ConfigType | EventName | Date, params?: EventParams | ControlParams | ConfigGaMeasurementIdParams | ActionParams): void;
};
export declare type Command = 'event' | 'set' | 'js' | 'config';
export declare type ConfigType = '[AW_CONVERSION_ID]' | '[GA_MEASUREMENT_ID]' | string;
export declare type ConfigGaMeasurementIdParams = {
page_title?: string;
page_location?: string;
page_path?: string;
send_page_view?: boolean;
};
export declare type ConfigUserIdParams = {
user_id: string;
};
export declare type EventName = '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';
export declare type EventParams = AddToCartParams | AddToWishlistParams | BeginCheckoutParams | CheckoutProgressParams | ExceptionParams | GenerateLeadParams | LoginParams | PurchaseParams | RefundParams | RemoveFromCartParams | ScreenViewParams | SearchParams | SelectContentParams | SetCheckoutOptionParams | ShareParams | SignUpParams | TimingCompleteParams | ViewItemParams | ViewItemListParams | ViewPromotionParams | ViewSearchResultsParams;
export declare type AddToCartParams = {
value: value;
currency: currency;
items: items;
};
export declare type AddToWishlistParams = {
value: value;
currency: currency;
items: items;
};
export declare type BeginCheckoutParams = {
value: value;
currency: currency;
items: items;
coupon: coupon;
};
export declare type CheckoutProgressParams = {
value: value;
currency: currency;
items: items;
coupon: coupon;
checkout_step: checkout_step;
checkout_option: checkout_option;
};
export declare type ExceptionParams = {
description: description;
fatal: fatal;
};
export declare type GenerateLeadParams = {
value: value;
currency: currency;
transaction_id: transaction_id;
};
export declare type LoginParams = {
method: method;
};
export declare type PurchaseParams = {
transaction_id: transaction_id;
value: value;
currency: currency;
tax: tax;
shipping: shipping;
items: items;
coupon: coupon;
};
export declare type RefundParams = {
transaction_id: transaction_id;
value: value;
currency: currency;
tax: tax;
shipping: shipping;
items: items;
};
export declare type RemoveFromCartParams = {
value: value;
currency: currency;
items: items;
};
export declare type ScreenViewParams = {
screen_name: screen_name;
app_name: string;
app_id?: string;
app_version?: string;
app_installer_id?: string;
};
export declare type SearchParams = {
search_term: search_term;
};
export declare type SelectContentParams = {
items: items;
promotions: promotions;
content_type: content_type;
content_id: content_id;
};
export declare type SetCheckoutOptionParams = {
checkout_step: checkout_step;
checkout_option: checkout_option;
};
export declare type ShareParams = {
method: method;
content_type: content_type;
content_id: content_id;
};
export declare type SignUpParams = {
method: method;
};
export declare type TimingCompleteParams = {
name: name;
value: value;
};
export declare type ViewItemParams = {
items: items;
};
export declare type ViewItemListParams = {
items: items;
};
export declare type ViewPromotionParams = {
promotions: promotions;
};
export declare type ViewSearchResultsParams = {
search_term: search_term;
};
/**
* action parameter
*/
export declare type ActionParams = {
event_category: string;
event_label?: string;
value?: number;
};
/**
* control parameter
*/
export declare type ControlParams = {
groups: string | string[];
send_to: string | string[];
event_callback: () => void;
event_timeout: number;
};
/**
* event parameter
*/
export declare type checkout_option = string;
export declare type checkout_step = number;
export declare type content_id = string;
export declare type content_type = string;
export declare type coupon = string;
export declare type currency = 'KRW' | 'USD' | string;
export declare type description = string;
export declare type fatal = boolean;
export declare type items = viewItem[] | purchaseItem[];
export declare type viewItem = {
item_id: string;
item_name: string;
item_list_name?: string;
item_list_id?: string;
index?: number;
item_brand?: string;
item_category?: string;
item_category2?: string;
item_category3?: string;
item_category4?: string;
item_category5?: string;
item_variant?: string;
affiliation?: string;
discount?: number;
coupon?: string;
price?: number;
};
export declare type purchaseItem = {
item_id: string;
item_name: string;
item_brand?: string;
item_category?: string;
item_category2?: string;
item_category3?: string;
item_category4?: string;
item_category5?: string;
item_variant?: string;
affiliation?: string;
discount?: number;
coupon?: string;
price?: number;
currency?: string;
quantity?: number;
};
export declare type method = string;
export declare type name = string;
export declare type promotions = promotion[];
export declare type promotion = {
creative_name: string;
creative_slot: string;
id: string;
name: string;
};
export declare type screen_name = string;
export declare type search_term = string;
export declare type shipping = number;
export declare type tax = number;
export declare type transaction_id = string;
export declare type value = number;