forked from angulartics/angulartics2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathga-enhanced-ecom-options.ts
137 lines (132 loc) · 5.35 KB
/
ga-enhanced-ecom-options.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/**
* Product and Promotion Actions
*
* Actions specify how to interpret product and promotion data that you send to Google Analytics.
*/
export type GaEnhancedEcomAction =
| 'click' // A click on a product or product link for one or more products.
| 'detail' // A view of product details.
| 'add' // Adding one or more products to a shopping cart.
| 'remove' // Remove one or more products from a shopping cart.
| 'checkout' // Initiating the checkout process for one or more products.
| 'checkout_option' // Sending the option value for a given checkout step.
| 'purchase' // The sale of one or more products.
| 'refund' // The refund of one or more products.
| 'promo_click'; // A click on an internal promotion.
/**
* Impression Data
*
* Represents information about a product that has been viewed. It is
* referred to as an impressionFieldObject and contains the following values.
*
* @link https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce#impression-data
*/
export interface GaEnhancedEcomImpressionFieldObject {
/** The product ID or SKU (e.g. P67890). *Either this field or name must be set. */
id: string;
/** The name of the product (e.g. Android T-Shirt). *Either this field or id must be set. */
name: string;
/** The list or collection to which the product belongs (e.g. Search Results) */
list: string;
/** The brand associated with the product (e.g. Google). */
brand: string;
/**
* The category to which the product belongs (e.g. Apparel).
* Use / as a delimiter to specify up to 5-levels of hierarchy (e.g. Apparel/Men/T-Shirts)
*/
category: string;
/** The variant of the product (e.g. Black). */
variant: string;
/** The product's position in a list or collection (e.g. 2) */
position: number;
/** The price of a product (e.g. 29.20) */
price: number;
}
/**
* Product Data
*
* Product data represents individual products that were viewed, added
* to the shopping cart, etc. It is referred to as a productFieldObject
* and contains the following values.
*
* @link https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce#product-data
*/
export interface GaEnhancedEcomProductFieldObject {
/** The product ID or SKU (e.g. P67890). *Either this field or name must be set. */
id: string;
/** The name of the product (e.g. Android T-Shirt). *Either this field or id must be set. */
name: string;
/** The brand associated with the product (e.g. Google). */
brand: string;
/**
* The category to which the product belongs (e.g. Apparel).
* Use / as a delimiter to specify up to 5-levels of hierarchy (e.g. Apparel/Men/T-Shirts).
*/
category: string;
/** The variant of the product (e.g. Black). */
variant: string;
/** The price of a product (e.g. 29.20). */
price: number;
/** The quantity of a product (e.g. 2). */
quantity: number;
/** The coupon code associated with a product (e.g. SUMMER_SALE13). */
coupon: string;
/** The product's position in a list or collection (e.g. 2). */
position: number;
}
/**
* Promotion Data
*
* Represents information about a promotion that has been viewed.
* It is referred to a promoFieldObject and contains the following values.
*
* @link https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce#promotion-data
*/
export interface GaEnhancedEcomPromoFieldObject {
/** The promotion ID (e.g. PROMO_1234). *Either this field or name must be set. */
id: string;
/** The name of the promotion (e.g. Summer Sale). *Either this field or id must be set. */
name: string;
/** The creative associated with the promotion (e.g. summer_banner2). */
creative: string;
/** The position of the creative (e.g. banner_slot_1). */
position: string;
}
/**
* Action Data
*
* Represents information about an ecommerce related action
* that has taken place. It is referred to as an actionFieldObject
* and contains the following values.
*
* @link https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce#action-data
*/
export interface GaEnhancedEcomActionFieldObject {
/** The transaction ID (e.g. T1234). *Required if the action type is purchase or refund. */
id: string;
/** The store or affiliation from which this transaction occurred (e.g. Google Store). */
affiliation: string;
/**
* Specifies the total revenue or grand total associated with the transaction (e.g. 11.99).
* This value may include shipping, tax costs, or other adjustments to total revenue that
* you want to include as part of your revenue calculations. Note: if revenue is not set,
* its value will be automatically calculated using the product quantity and price fields
* of all products in the same hit.
*/
revenue: number;
/** The total tax associated with the transaction. */
tax: number;
/** The shipping cost associated with the transaction. */
shipping: number;
/** The transaction coupon redeemed with the transaction. */
coupon: string;
/** The list that the associated products belong to. Optional. */
list: string;
/** A number representing a step in the checkout process. Optional on checkout actions. */
step: number;
/**
* Additional field for checkout and checkout_option actions that can describe
* option information on the checkout page, like selected payment method.
*/
option: string;
}