fix(analytics): add backward compatibility aliases for old method names
Build and Deploy / build (push) Has been cancelled
Build and Deploy / build (push) Has been cancelled
The new AnalyticsTracker had different method names than the old useAnalytics hook. Added aliases like trackCheckoutStarted -> checkoutStarted etc. to maintain backward compatibility with existing components.
This commit is contained in:
@@ -100,6 +100,22 @@ export class AnalyticsTracker {
|
||||
newsletterSignedUp(email: string, source: string) {
|
||||
this.track({ type: "newsletter_signup", email, source });
|
||||
}
|
||||
|
||||
// Backward compatibility aliases (old method names)
|
||||
trackProductView = this.productViewed;
|
||||
trackAddToCart = this.addToCart;
|
||||
trackRemoveFromCart = this.removeFromCart;
|
||||
trackCartView = this.cartViewed;
|
||||
trackCheckoutStarted = this.checkoutStarted;
|
||||
trackCheckoutStep = this.checkoutStep;
|
||||
trackOrderCompleted = this.orderCompleted;
|
||||
trackSearch = this.searchPerformed;
|
||||
trackExternalLink = this.externalLinkClicked;
|
||||
trackWishlistAdd = this.wishlistAdded;
|
||||
trackUserLogin = this.userLoggedIn;
|
||||
trackUserRegister = this.userRegistered;
|
||||
trackNewsletterSignup = this.newsletterSignedUp;
|
||||
identifyUser = this.identify;
|
||||
}
|
||||
|
||||
let trackerInstance: AnalyticsTracker | null = null;
|
||||
|
||||
Reference in New Issue
Block a user