Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 40 additions & 40 deletions src/components/ga4/EventBuilder/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,19 @@ const add_payment_info = eventFor(
stringParam("coupon", "SUMMER_FUN"),
stringParam("currency", "USD"),
stringParam("payment_type", "Credit Card"),
numberParam("value", 7.77),
numberParam("value", 30.03),
],
[
stringParam("item_id", "SKU_12345"),
stringParam("item_name", "jeggings"),
numberParam("quantity", 1),
numberParam("quantity", 3),
stringParam("affiliation", "Google Store"),
stringParam("coupon", "SUMMER_FUN"),
numberParam("discount", 2.22),
stringParam("item_brand", "Gucci"),
stringParam("item_category", "pants"),
stringParam("item_variant", "Black"),
numberParam("price", 9.99),
numberParam("price", 10.01),
stringParam("currency", "USD"),
]
)
Expand All @@ -81,57 +81,57 @@ const add_shipping_info = eventFor(
stringParam("coupon", "SUMMER_FUN"),
stringParam("currency", "USD"),
stringParam("shipping_tier", "Ground"),
numberParam("value", 7.77),
numberParam("value", 30.03),
],
[
stringParam("item_id", "SKU_12345"),
stringParam("item_name", "jeggings"),
numberParam("quantity", 1),
numberParam("quantity", 3),
stringParam("affiliation", "Google Store"),
stringParam("coupon", "SUMMER_FUN"),
numberParam("discount", 2.22),
stringParam("item_brand", "Gucci"),
stringParam("item_category", "pants"),
stringParam("item_variant", "Black"),
numberParam("price", 9.99),
numberParam("price", 10.01),
stringParam("currency", "USD"),
]
)

const add_to_cart = eventFor(
EventType.AddToCart,
[Category.RetailEcommerce],
[stringParam("currency", "USD"), numberParam("value", 7.77)],
[stringParam("currency", "USD"), numberParam("value", 30.03)],
[
stringParam("item_id", "SKU_12345"),
stringParam("item_name", "jeggings"),
numberParam("quantity", 1),
numberParam("quantity", 3),
stringParam("affiliation", "Google Store"),
stringParam("coupon", "SUMMER_FUN"),
numberParam("discount", 2.22),
stringParam("item_brand", "Gucci"),
stringParam("item_category", "pants"),
stringParam("item_variant", "Black"),
numberParam("price", 9.99),
numberParam("price", 10.01),
stringParam("currency", "USD"),
]
)

const add_to_wishlist = eventFor(
EventType.AddToWishlist,
[Category.RetailEcommerce],
[stringParam("currency", "USD"), numberParam("value", 7.77)],
[stringParam("currency", "USD"), numberParam("value", 30.03)],
[
stringParam("item_id", "SKU_12345"),
stringParam("item_name", "jeggings"),
numberParam("quantity", 1),
numberParam("quantity", 3),
stringParam("affiliation", "Google Store"),
stringParam("coupon", "SUMMER_FUN"),
numberParam("discount", 2.22),
stringParam("item_brand", "Gucci"),
stringParam("item_category", "pants"),
stringParam("item_variant", "Black"),
numberParam("price", 9.99),
numberParam("price", 10.01),
stringParam("currency", "USD"),
]
)
Expand All @@ -142,19 +142,19 @@ const begin_checkout = eventFor(
[
stringParam("coupon", "SUMMER_FUN"),
stringParam("currency", "USD"),
numberParam("value", 7.77),
numberParam("value", 30.03),
],
[
stringParam("item_id", "SKU_12345"),
stringParam("item_name", "jeggings"),
numberParam("quantity", 1),
numberParam("quantity", 3),
stringParam("affiliation", "Google Store"),
stringParam("coupon", "SUMMER_FUN"),
numberParam("discount", 2.22),
stringParam("item_brand", "Gucci"),
stringParam("item_category", "pants"),
stringParam("item_variant", "Black"),
numberParam("price", 9.99),
numberParam("price", 10.01),
stringParam("currency", "USD"),
]
)
Expand Down Expand Up @@ -209,20 +209,20 @@ const purchase = eventFor(
stringParam("transaction_id", "T_12345"),
numberParam("shipping", 3.33),
numberParam("tax", 1.11),
numberParam("value", 12.21),
numberParam("value", 30.03),
],
[
stringParam("item_id", "SKU_12345"),
stringParam("item_name", "jeggings"),
numberParam("quantity", 1),
numberParam("quantity", 3),
stringParam("affiliation", "Google Store"),
stringParam("coupon", "SUMMER_FUN"),
numberParam("discount", 2.22),
stringParam("item_brand", "Gucci"),
stringParam("item_category", "pants"),
stringParam("item_variant", "Black"),
numberParam("tax", 1.11),
numberParam("price", 9.99),
numberParam("price", 10.01),
stringParam("currency", "USD"),
]
)
Expand All @@ -237,39 +237,39 @@ const refund = eventFor(
stringParam("transaction_id", "T_12345"),
numberParam("shipping", 3.33),
numberParam("tax", 1.11),
numberParam("value", 12.21),
numberParam("value", 30.03),
],
[
stringParam("item_id", "SKU_12345"),
stringParam("item_name", "jeggings"),
numberParam("quantity", 1),
numberParam("quantity", 3),
stringParam("affiliation", "Google Store"),
stringParam("coupon", "SUMMER_FUN"),
numberParam("discount", 2.22),
stringParam("item_brand", "Gucci"),
stringParam("item_category", "pants"),
stringParam("item_variant", "Black"),
numberParam("tax", 1.11),
numberParam("price", 9.99),
numberParam("price", 10.01),
stringParam("currency", "USD"),
]
)

const remove_from_cart = eventFor(
EventType.RemoveFromCart,
[Category.RetailEcommerce],
[stringParam("currency", "USD"), numberParam("value", 7.77)],
[stringParam("currency", "USD"), numberParam("value", 30.03)],
[
stringParam("item_id", "SKU_12345"),
stringParam("item_name", "jeggings"),
numberParam("quantity", 1),
numberParam("quantity", 3),
stringParam("affiliation", "Google Store"),
stringParam("coupon", "SUMMER_FUN"),
numberParam("discount", 2.22),
stringParam("item_brand", "Gucci"),
stringParam("item_category", "pants"),
stringParam("item_variant", "Black"),
numberParam("price", 9.99),
numberParam("price", 10.01),
stringParam("currency", "USD"),
]
)
Expand All @@ -296,7 +296,7 @@ const select_item = eventFor(
[
stringParam("item_id", "SKU_12345"),
stringParam("item_name", "jeggings"),
numberParam("quantity", 1),
numberParam("quantity", 3),
stringParam("affiliation", "Google Store"),
stringParam("coupon", "SUMMER_FUN"),
numberParam("discount", 2.22),
Expand All @@ -306,7 +306,7 @@ const select_item = eventFor(
stringParam("item_list_name", "Related products"),
stringParam("item_list_id", "related_products"),
stringParam("item_variant", "Black"),
numberParam("price", 9.99),
numberParam("price", 10.01),
stringParam("currency", "USD"),
]
)
Expand All @@ -318,7 +318,7 @@ const select_promotion = eventFor(
[
stringParam("item_id", "SKU_12345"),
stringParam("item_name", "jeggings"),
numberParam("quantity", 1),
numberParam("quantity", 3),
stringParam("promotion_id", "P_12345"),
stringParam("promotion_name", "Summer Sale"),
stringParam("affiliation", "Google Store"),
Expand All @@ -330,7 +330,7 @@ const select_promotion = eventFor(
stringParam("item_category", "pants"),
stringParam("item_variant", "Black"),
stringParam("location_id", "L_12345"),
numberParam("price", 9.99),
numberParam("price", 10.01),
stringParam("currency", "USD"),
]
)
Expand Down Expand Up @@ -378,37 +378,37 @@ const unlock_achievement = eventFor(
const view_cart = eventFor(
EventType.ViewCart,
[Category.RetailEcommerce],
[stringParam("currency", "USD"), numberParam("value", 7.77)],
[stringParam("currency", "USD"), numberParam("value", 30.03)],
[
stringParam("item_id", "SKU_12345"),
stringParam("item_name", "jeggings"),
numberParam("quantity", 1),
numberParam("quantity", 3),
stringParam("affiliation", "Google Store"),
stringParam("coupon", "SUMMER_FUN"),
numberParam("discount", 2.22),
stringParam("item_brand", "Gucci"),
stringParam("item_category", "pants"),
stringParam("item_variant", "Black"),
numberParam("price", 9.99),
numberParam("price", 10.01),
stringParam("currency", "USD"),
]
)

const view_item = eventFor(
EventType.ViewItem,
[Category.RetailEcommerce],
[stringParam("currency", "USD"), numberParam("value", 7.77)],
[stringParam("currency", "USD"), numberParam("value", 30.03)],
[
stringParam("item_id", "SKU_12345"),
stringParam("item_name", "jeggings"),
numberParam("quantity", 1),
numberParam("quantity", 3),
stringParam("affiliation", "Google Store"),
stringParam("coupon", "SUMMER_FUN"),
numberParam("discount", 2.22),
stringParam("item_brand", "Gucci"),
stringParam("item_category", "pants"),
stringParam("item_variant", "Black"),
numberParam("price", 9.99),
numberParam("price", 10.01),
stringParam("currency", "USD"),
]
)
Expand All @@ -423,7 +423,7 @@ const view_item_list = eventFor(
[
stringParam("item_id", "SKU_12345"),
stringParam("item_name", "jeggings"),
numberParam("quantity", 1),
numberParam("quantity", 3),
stringParam("affiliation", "Google Store"),
stringParam("coupon", "SUMMER_FUN"),
numberParam("discount", 2.22),
Expand All @@ -433,7 +433,7 @@ const view_item_list = eventFor(
stringParam("item_list_name", "Related products"),
stringParam("item_list_id", "related_products"),
stringParam("item_variant", "Black"),
numberParam("price", 9.99),
numberParam("price", 10.01),
stringParam("currency", "USD"),
]
)
Expand All @@ -445,7 +445,7 @@ const view_promotion = eventFor(
[
stringParam("item_id", "SKU_12345"),
stringParam("item_name", "jeggings"),
numberParam("quantity", 1),
numberParam("quantity", 3),
stringParam("promotion_id", "P_12345"),
stringParam("promotion_name", "Summer Sale"),
stringParam("affiliation", "Google Store"),
Expand All @@ -457,7 +457,7 @@ const view_promotion = eventFor(
stringParam("item_category", "pants"),
stringParam("item_variant", "Black"),
stringParam("location_id", "L_12345"),
numberParam("price", 9.99),
numberParam("price", 10.01),
stringParam("currency", "USD"),
]
)
Expand All @@ -469,7 +469,7 @@ const view_search_results = eventFor(
[
stringParam("item_id", "SKU_12345"),
stringParam("item_name", "jeggings"),
numberParam("quantity", 1),
numberParam("quantity", 3),
stringParam("affiliation", "Google Store"),
stringParam("coupon", "SUMMER_FUN"),
numberParam("discount", 2.22),
Expand All @@ -479,7 +479,7 @@ const view_search_results = eventFor(
stringParam("item_list_name", "Related products"),
stringParam("item_list_id", "related_products"),
stringParam("item_variant", "Black"),
numberParam("price", 9.99),
numberParam("price", 10.01),
stringParam("currency", "USD"),
]
)
Expand Down