Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weekly release main 06-02-2024 #984

Merged
merged 2 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ Object {
"ProductUpdatedWishlist": "Product Updated In Wishlist",
"ProductViewed": "Product Viewed",
"PromocodeApplied": "Promocode Applied",
"ReviewCheckout": "Review Checkout",
"SelectContent": "Select Content",
"Share": "Share",
"ShippingInfoAdded": "Shipping Info Added",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,22 +268,6 @@ Object {
}
`;

exports[`Omnitracking track events definitions \`Review Checkout\` return should match the snapshot 1`] = `
Object {
"basketCurrency": "USD",
"basketValue": 24.64,
"checkoutOrderId": 15338048,
"checkoutStep": "2",
"deliveryInformationDetails": "{\\"deliveryType\\":\\"Standard/Standard\\",\\"courierType\\":\\"Next Day\\",\\"packagingType\\":\\"foo\\"}",
"orderCode": "50314b8e9bcf000000000000",
"orderVAT": 2.04,
"paymentType": "credit",
"promoCode": "ACME2019",
"shippingTotalValue": 3.6,
"tid": 3648,
}
`;

exports[`Omnitracking track events definitions \`Select Content\` return should match the snapshot 1`] = `
Object {
"contentType": "biz",
Expand Down
12 changes: 0 additions & 12 deletions packages/analytics/src/integrations/Omnitracking/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -820,18 +820,6 @@ export const trackEventsMapper: Readonly<OmnitrackingTrackEventsMapper> = {

return;
},
[EventType.ReviewCheckout]: data => ({
tid: 3648,
...getCheckoutEventGenericProperties(data),
basketCurrency: data.properties?.currency,
basketValue: data.properties?.total,
checkoutStep: data.properties?.step,
deliveryInformationDetails: getDeliveryInformationDetails(data),
orderVAT: data.properties?.tax,
paymentType: data.properties?.paymentType,
promoCode: data.properties?.coupon,
shippingTotalValue: data.properties?.shipping,
}),
} as const;

/**
Expand Down
5 changes: 0 additions & 5 deletions packages/analytics/src/types/EventType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,6 @@ enum EventType {
* checkout.
*/
PromocodeApplied = 'Promocode Applied',
/**
* Review Checkout should be tracked when the user reaches the review checkout
* step page.
*/
ReviewCheckout = 'Review Checkout',
/**
* Select Content should be tracked when the user selects a content, i.e., a
* product item.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ Object {
"ProductUpdatedWishlist": "Product Updated In Wishlist",
"ProductViewed": "Product Viewed",
"PromocodeApplied": "Promocode Applied",
"ReviewCheckout": "Review Checkout",
"SelectContent": "Select Content",
"Share": "Share",
"ShippingInfoAdded": "Shipping Info Added",
Expand Down
20 changes: 10 additions & 10 deletions packages/analytics/src/types/analytics.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,21 +119,21 @@ export type UseContextFn = () => CommonContextData & { event?: never } & Record<
>;

export type AnalyticsProduct = {
affiliation?: string;
brand?: string;
category?: string;
coupon?: string;
currency?: string;
discountValue?: number;
id?: string;
list?: string;
listId?: string;
name?: string;
currency?: string;
category?: string;
brand?: string;
variant?: string;
position?: number;
price?: number;
priceWithoutDiscount?: number;
quantity?: number;
affiliation?: string;
position?: number;
discountValue?: number;
coupon?: string;
list?: string;
listId?: string;
size?: string;
unitSalePrice?: number;
variant?: string;
} & Record<string, unknown>;
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ Object {
"ProductUpdatedWishlist": "Product Updated In Wishlist",
"ProductViewed": "Product Viewed",
"PromocodeApplied": "Promocode Applied",
"ReviewCheckout": "Review Checkout",
"SelectContent": "Select Content",
"Share": "Share",
"ShippingInfoAdded": "Shipping Info Added",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -984,33 +984,6 @@ Array [
]
`;

exports[`GA4 Integration GA4 instance When it is instantiated correctly Event Mappings Track events Should map the Review Checkout event correctly 1`] = `
Array [
Array [
"event",
"review_checkout",
Object {
"affiliation": undefined,
"analytics_package_version": "0.1.0",
"blackoutAnalyticsEventId": "4eabf689-96e3-4952-8176-248a848f1e1f",
"checkout_step": "2",
"coupon": "ACME2019",
"currency": "USD",
"delivery_type": "Standard/Standard",
"packaging_type": "foo",
"page_path": "/en-pt/?utm_term=utm_term&utm_source=utm_source&utm_medium=utm_medium&utm_content=utm_content&utm_campaign=utm_campaign",
"path_clean": "/en-pt/",
"payment_type": "credit",
"shipping": 3.6,
"shipping_tier": "Next Day",
"tax": 2.04,
"transaction_id": "50314b8e9bcf000000000000",
"value": 24.64,
},
],
]
`;

exports[`GA4 Integration GA4 instance When it is instantiated correctly Event Mappings Track events Should map the Select Content event correctly 1`] = `
Array [
Array [
Expand Down
30 changes: 0 additions & 30 deletions packages/react/src/analytics/integrations/GA4/eventMapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ const eventMapping = {
[EventType.ShippingMethodAdded]: 'add_shipping_method',
[EventType.InteractContent]: 'interact_content',
[EventType.SignupNewsletter]: 'sign_up_newsletter',
[EventType.ReviewCheckout]: 'review_checkout',
// internal ga4 cases
[InternalEventTypes.ProductUpdated.CHANGE_QUANTITY]:
InternalEventTypes.ProductUpdated.CHANGE_QUANTITY,
Expand Down Expand Up @@ -776,32 +775,6 @@ const getCheckoutStepEditingParametersFromEvent = (
};
};

/**
* Returns the review checkout custom event properties formatted for the GA4 event.
*
* @param eventProperties - Properties from a track event.
*
* @returns Properties formatted for the GA4's review checkout custom event.
*/
const getReviewCheckoutParametersFromEvent = (
eventProperties: EventProperties,
) => {
return {
affiliation: eventProperties.affiliation,
checkout_step: eventProperties.step,
coupon: eventProperties.coupon,
currency: eventProperties.currency,
delivery_type: eventProperties.deliveryType,
packaging_type: eventProperties.packagingType,
payment_type: eventProperties.paymentType,
shipping_tier: eventProperties.shippingTier,
shipping: eventProperties.shipping,
tax: eventProperties.tax,
transaction_id: eventProperties.orderId,
value: eventProperties.total,
};
};

/**
* Returns the share properties formatted for the GA4 event.
*
Expand Down Expand Up @@ -952,9 +925,6 @@ export function getEventProperties(
case EventType.CheckoutAbandoned:
return getCheckoutAbandonedParametersFromEvent(eventProperties);

case EventType.ReviewCheckout:
return getReviewCheckoutParametersFromEvent(eventProperties);

case EventType.PlaceOrderStarted:
return getPlaceOrderStartedParametersFromEvent(eventProperties);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,19 +206,6 @@ const checkoutAbandonedSchema = currencySchema
const promocodeAppliedSchema =
checkoutShippingStepSchema.concat(couponRequiredSchema);

const reviewCheckoutSchema = currencySchema
.concat(couponSchema)
.concat(totalSchema)
.concat(orderIdSchema)
.concat(affiliationSchema)
.concat(shippingSchema)
.concat(taxSchema)
.concat(deliveryTypeSchema)
.concat(packagingTypeSchema)
.concat(shippingTierSchema)
.concat(checkoutStepEditingSchema)
.concat(checkoutPaymentStepSchema);

const placeOrderStartedSchema = currencyRequiredSchema
.concat(couponSchema)
.concat(totalRequiredSchema)
Expand Down Expand Up @@ -345,7 +332,6 @@ const eventSchemas = {
[EventType.ProductUpdated]: productUpdatedSchema,
[EventType.InteractContent]: interactContentSchema,
[EventType.SignupNewsletter]: signupNewsletterSchema,
[EventType.ReviewCheckout]: reviewCheckoutSchema,
};

export default eventSchemas;
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,14 @@ describe('GTM', () => {
tax: 23,
total: 1000,
paymentType: 'paypal',
deliveryType: 'Standard/standard',
shippingTier: 'Next Day',
packagingType: 'dummy',
value: 123123,
orderId: 'OFH1213',
method: 'guest',
coupon: 'ACME2019',
currency: 'EUR',
// product generic properties - Array of products
products: [
{
Expand Down
Loading
Loading