Composables
Types
TrackingAuthEvent
Authentication-related tracking events for analytics. Used in authentication composables and checkout flows to track user authentication actions.
PageType
Page type identifiers for tracking page views and navigation. Used in route meta, tracking context, and analytics systems to categorize page visits. Allows string values for custom page types not covered by predefined types.
TrackingCustomerType
Customer classification based on account status and history. Used in tracking and analytics to segment users for behavior analysis.
TrackingInteractionSource
Source of user interaction that triggered a tracking event. Used in tracking events to identify which UI component or modal triggered the action.
TrackingSorting
Sorting options for product listing pages.
TrackingPageContext
Page-level tracking context for navigation and page view analytics. Used in tracking composables to capture current and previous page information. Includes interaction source for tracking user actions that triggered navigation.
Properties
| Property | Type | Description |
|---|---|---|
current_page_path | string | undefined | Current page URL path. |
current_page_type | PageType | undefined | Current page type identifier (e.g., 'pdp', 'category', 'basket'). |
previous_page_path | string | undefined | Previous page URL path (optional, set during navigation). |
previous_page_type | PageType | undefined | Previous page type identifier (optional, set during navigation). |
interaction_source | TrackingInteractionSource | undefined | Source that triggered the page interaction (optional). |
TrackingSessionContext
Session-level tracking context containing shop, user, and session metadata. Used in analytics systems to provide session-wide context for all tracking events. Captures landing page information, referrer data, and customer authentication state.
Properties
| Property | Type | Description |
|---|---|---|
shop_id | number | Shop identifier number (unique shop ID from SCAYLE). |
shop_currency | string | Shop currency code (ISO 4217 format, e.g., 'EUR', 'USD'). |
locale | string | Locale identifier (e.g., 'de-DE', 'en-US'). |
shop_version | string | Application version string. |
landing_page | string | Absolute URL of the first page visited in this session. |
parameter | string | Raw query string from the landing page (includes utm_* parameters). |
referrer | string | undefined | First external referrer URL (optional, only set if user came from external site). |
customer_id | string | undefined | Customer identifier (optional, only set for logged-in users). |
customer_type | TrackingCustomerType | undefined | Customer classification (optional, 'guest', 'new', or 'existing'). |
customer_groups | string[] | undefined | Customer group identifiers (optional, array of group names). |
login | boolean | Whether user is logged in (defaults to false for guests). |
login_method | AuthenticationType | undefined | Authentication method used (optional, e.g., 'password'). |
eh | string | undefined | SHA256 hash of user email (optional, never raw email, used for analytics). |
CheckoutEvent
Checkout event used for tracking with Google Tag Manager.
Properties
| Property | Type | Description |
|---|---|---|
action | 'authenticated' | undefined | Action type. |
type | 'tracking' | undefined | Event type. |
user | ShopUser | User information. |
accessToken | string | The OAuth 2.0 access token for the authenticated user. |
event | CartEvent | CompleteCheckoutEvent | PaymentInfoEvent | ShippingInfoEvent | undefined | Details about a specific event within the checkout process. |
TrackingEcommerceItem
Ecommerce item for tracking. Used in tracking events to track items in the basket, wishlist, etc.
Properties
| Property | Type | Description |
|---|---|---|
item_id | string | undefined | Unique product identifier (e.g., SKU, product ID). |
item_name | string | undefined | Product name or title. |
price_with_tax | CentAmount | undefined | Net item unit price in shop currency. |
original_price_with_tax | CentAmount | undefined | Gross item unit price in shop currency. |
quantity | number | undefined | Quantity of items. |
currency | string | undefined | Currency code (ISO 4217 format, e.g., 'EUR', 'USD'). |
item_brand | string | undefined | Brand name. |
item_brand_id | string | undefined | Brand identifier. |
item_size | string | undefined | Product size (e.g., 'M', '42', 'Large'). |
index | number | undefined | Position index in list (0-based). |
sold_out | boolean | undefined | Whether the item is sold out. |
item_category | string | undefined | First category name of the category list for the product. |
item_category_id | string | undefined | First category identifier of the category list for the product. |
item_category2 | string | undefined | Second category name of the category list for the product. |
item_category2_id | string | undefined | Second category identifier of the category list for the product. |
item_category3 | string | undefined | Third category name of the category list for the product. |
item_category3_id | string | undefined | Third category identifier of the category list for the product. |
item_category4 | string | undefined | Fourth category name of the category list for the product. |
item_category4_id | string | undefined | Fourth category identifier of the category list for the product. |
item_category5 | string | undefined | Fifth category name of the category list for the product. |
item_category5_id | string | undefined | Fifth category identifier of the category list for the product. |
item_list_name | string | undefined | List name where item appears (e.g., 'Search Results', 'You May Also Like'). |
tax | CentAmount | undefined | Tax amount for this individual item (in shop currency). |
sale_discount_with_tax | CentAmount | undefined | Discount amount from sale pricing including tax. |
campaign_discount_with_tax | CentAmount | undefined | Discount amount from campaign pricing including tax. |
promotion_discount_with_tax | CentAmount | undefined | Discount amount from promotion pricing including tax. |
promotion_id | string | undefined | Unique promotion identifier applied to this item. |
promotion_name | string | undefined | Internal promotion name (not displayed to users). |
promotion_display_name | string | undefined | Promotion display name shown to users. |
promotion_link | string | undefined | Promotion link URL. |
promotions | string[] | undefined | Array of promotion identifiers applied to this item. |
TrackingEcommercePayload
Ecommerce payload for tracking. Used in tracking events to track items in the basket, wishlist, etc.
Properties
| Property | Type | Description |
|---|---|---|
items | TrackingEcommerceItem[] | undefined | Array of ecommerce items included in the tracking event. |
transaction_id | string | undefined | Unique order or transaction reference number (e.g., order ID from checkout). |
customer_id | string | undefined | Customer account identifier. |
value | number | undefined | Total basket value including tax and discounts. |
sale_reduction_with_tax | number | undefined | Total discount amount from sale pricing including tax. |
campaign_reduction_with_tax | number | undefined | Total discount amount from campaigns including tax. |
promotion_reduction_with_tax | number | undefined | Total discount amount from promotions including tax. |
promotions | string[] | undefined | Array of promotion identifiers applied to the entire basket or transaction. |
tax | number | undefined | Total tax amount for the entire transaction. |
shipping | number | undefined | Shipping cost for the order. |
currency | string | undefined | Currency code for all monetary values (ISO 4217 format, e.g., 'EUR', 'USD'). |
payment_type | string | undefined | Payment method used for the transaction (e.g., 'credit_card', 'paypal', 'invoice'). |
TrackingEventName
Standard tracking event names for analytics. Used in tracking events to identify the type of user action or system event being tracked.
TrackingEvent
Complete tracking event payload for analytics. Used throughout the application to send structured tracking data to analytics systems. Combines event type, page context, session context, and optional ecommerce data.
Properties
| Property | Type | Description |
|---|---|---|
event | TrackingEventName | Type of tracking event being sent. |
page | TrackingPageContext | Page-level context for the current page and navigation. |
session | TrackingSessionContext | Session-level context with shop, user, and session metadata. |
ecommerce | TrackingEcommercePayload | undefined | Ecommerce data with items (optional, used for cart, purchase, etc.). |
[customKey: string] | unknown | Additional custom properties for extended tracking data. |
Functions
useTracking()
Provides a composable for managing tracking events with GTM. Uses useGtm composable to get the GTM instance and push the tracking event to the dataLayer. The provided data is merged with the page and session context. If the GTM instance is not available (on server side or not initialized), the event is not pushed.
Returns
| Property | Type | Description |
|---|---|---|
push | (data: Partial<TrackingEvent>) => void | Pushes a tracking event to the GTM dataLayer. Automatically merges with page and session context. |
useTrackingContext()
Provides reactive tracking context for page navigation and user sessions. Used in analytics and tracking systems to capture page views, user behavior, and session data. Persists previous page context and landing page across navigation using Nuxt state.
Returns
| Property | Type | Description |
|---|---|---|
page | ComputedRef<Omit<TrackingPageContext, 'interaction_source'>> | Current and previous page tracking data (path and type). |
session | ComputedRef<TrackingSessionContext> | Session-level tracking data including shop info, user data, landing page, referrer, and query parameters. |
useTrackingContextState()
Provides reactive tracking context state for page navigation and user sessions. Used in analytics and tracking systems to capture page views, user behavior, and session data. Persists previous page context and landing page across navigation using Nuxt state.
Returns
| Property | Type | Description |
|---|---|---|
previousPageContext | Ref<Pick<TrackingPageContext, 'previous_page_path' | 'previous_page_type'>> | Reactive state for previous page path and type. |
currentPageContext | Ref<Pick<TrackingPageContext, 'current_page_path' | 'current_page_type'>> | Reactive state for current page path and type. |
initialPage | Ref<string> | Reactive state for the landing page URL. |
setPreviousPageContext | (pagePath: string, pageType: PageType) => void | Updates the previous page context. |
setCurrentPageContext | (pagePath: string, pageType: PageType) => void | Updates the current page context. |
setInitialPage | (pagePath: string) => void | Updates the landing page URL. |
useGlobalEvents()
Composable for tracking global events.
Returns
| Property | Type | Description |
|---|---|---|
trackContentView | (data?: Partial<TrackingEvent>) => void | Tracks content view events. |
trackShopInitialization | () => void | Tracks shop initialization. |
trackError | ({ code?: number, message: string }) => void | Tracks error events. |
trackShopSwitch | () => void | Tracks shop switch events. |
useBasketEvents()
Provides tracking functionality for basket-related events. This composable tracks basket state changes and sends cart events to GTM with detailed basket information including items, totals, and applied reductions.
Returns
| Property | Type | Description |
|---|---|---|
trackBasket | (cost?: BasketTotalPrice, items?: BasketItem[]) => void | Tracks basket state with cost and items. |
trackAddToBasket | (variant: Variant, product: Product, quantity?: number, interactionSource?: TrackingInteractionSource) => void | Tracks when items are added to the basket. |
trackRemoveFromBasket | (item: BasketItem, interactionSource?: TrackingInteractionSource) => void | Tracks when items are removed from the basket. |
trackViewCart | (basketItems?: BasketItem[]) => void | Tracks when the cart is viewed. |
useCheckoutEvents()
Provides tracking functions for checkout-related events. Used in checkout pages and flows to track checkout progress, shipping, payment, and completion.
Returns
| Property | Type | Description |
|---|---|---|
trackBeginCheckout | (cost?: BasketTotalPrice, checkoutType?: 'regular' | 'express') => void | Tracks checkout initiation. |
trackAddShippingInfo | (shippingType: string, shippingMethod: string, currency: string, value: number, basketItems?: BasketItem[]) => void | Tracks shipping method selection. |
trackAddPaymentInfo | (paymentType: PaymentOptionKey, basketItems?: BasketItem[]) => void | Tracks payment method selection. |
trackCompleteCheckout | (basketItems: BasketItem[]) => void | Tracks checkout completion. |
useProductEvents()
Provides tracking functionality for product-related events. This composable tracks product interactions and sends product events to GTM with product data mapped to ecommerce format. Includes functions for tracking individual product views, product selections, and product list views.
Returns
| Property | Type | Description |
|---|---|---|
trackViewItem | (product?: Product | null, variant?: Variant) => void | Tracks when a product is viewed. |
trackSelectItem | (product: Product, itemListName?: string, index?: number) => void | Tracks when a product is selected (clicked). |
trackViewItemList | (products: Product[], itemListName?: string, searchTerm?: string) => void | Tracks when a product list is viewed. |
useSignInEvents()
Provides tracking functions for authentication-related events. Used in authentication composables and sign-in pages to track user authentication actions.
Returns
| Property | Type | Description |
|---|---|---|
trackSignUp | (successful: boolean) => void | Tracks sign-up attempts with success status. |
trackLogin | (successful: boolean) => void | Tracks login attempts with success status. |
trackLogout | () => void | Tracks logout events. |
useSearchEvents()
Composable for tracking search events.
Returns
| Property | Type | Description |
|---|---|---|
trackSearch | ({ query: string, suggestion: SearchEntity | 'show_all' }) => void | Tracks search events. |
getSearchDestination | (query: string, suggestion: SearchEntity | 'show_all') => string | undefined | Gets the destination URL for a search query and suggestion. |
useFilterEvents()
Composable for tracking filter and sorting interactions on product listing pages. Used in filter components and category pages to track user filter selections and sorting changes.
Returns
| Property | Type | Description |
|---|---|---|
trackApplyFilter | (type: string, value: string | boolean | number) => void | Tracks when a filter is applied. |
trackRemoveFilter | (type: string, value: string | boolean) => void | Tracks when a filter is removed. |
trackResetFilter | (type: string, value: string | boolean) => void | Tracks when a filter is reset. |
trackSorting | (value: TrackingSorting) => void | Tracks when sorting is changed. |
usePromotionEvents()
Composable for tracking promotion events.
Returns
| Property | Type | Description |
|---|---|---|
trackViewPromotion | (promotions: Promotion[]) => void | Tracks when promotions are viewed. |
trackViewCampaign | (campaign: Campaign) => void | Tracks when campaigns are viewed. |
trackSelectPromotion | (promotion: Promotion) => void | Tracks when a promotion is selected. |
trackSelectCampaign | (campaign: Campaign) => void | Tracks when a campaign is selected. |
useWishlistEvents()
Provides tracking functionality for wishlist-related events. This composable tracks wishlist state changes and sends wishlist events to GTM with wishlist item information.
Returns
| Property | Type | Description |
|---|---|---|
trackWishlist | (items?: WishlistItem[]) => void | Tracks wishlist state with items. |
trackAddToWishlist | (product: Product, itemListName?: string) => void | Tracks when items are added to the wishlist. |
trackRemoveFromWishlist | (product: Product, itemListName?: string) => void | Tracks when items are removed from the wishlist. |
useOrderEvents()
Composable for tracking order-related events in the checkout and order success flows. Used on order success pages to track completed purchases with full transaction details.
Returns
| Property | Type | Description |
|---|---|---|
trackPurchase | (order: Order) => void | Tracks completed purchases with full order details. |
mapBasketItemToTracking()
Maps a basket item to an ecommerce item. Used in basket event tracking to map basket items to ecommerce items.
Parameters
| Parameter | Type | Description |
|---|---|---|
basketItem | BasketItem | The basket item to map. |
Returns
| Property | Type | Description |
|---|---|---|
| Returns | TrackingEcommerceItem | The ecommerce item. |
mapProductToTracking()
Maps a product to an ecommerce item. Used in product event tracking to map products to ecommerce items.
Parameters
| Parameter | Type | Description |
|---|---|---|
product | Product | The product to map. |
Returns
| Property | Type | Description |
|---|---|---|
| Returns | TrackingEcommerceItem | The ecommerce item. |
mapVariantToTracking()
Maps a variant to an ecommerce item. Used in product event tracking to map variants to ecommerce items.
Parameters
| Parameter | Type | Description |
|---|---|---|
variant | Variant | The variant to map. |
Returns
| Property | Type | Description |
|---|---|---|
| Returns | TrackingEcommerceItem | The ecommerce item. |
getSalePriceFromAppliedReductions()
Extracts the sale discount amount from applied reductions. Used in price mapping to populate sale_discount_with_tax field.
Parameters
| Parameter | Type | Description |
|---|---|---|
appliedReductions | AppliedReduction[] | Array of applied price reductions. |
Returns
| Property | Type | Description |
|---|---|---|
| Returns | CentAmount | undefined | Sale discount amount in cents, or undefined if no sale reduction found. |
getCampaignPriceFromAppliedReductions()
Extracts the campaign discount amount from applied reductions. Used in price mapping to populate campaign_discount_with_tax field.
Parameters
| Parameter | Type | Description |
|---|---|---|
appliedReductions | AppliedReduction[] | Array of applied price reductions. |
Returns
| Property | Type | Description |
|---|---|---|
| Returns | CentAmount | undefined | Campaign discount amount in cents, or undefined if no campaign reduction found. |
getPromotionPriceFromAppliedReductions()
Extracts the promotion discount amount from applied reductions. Used in price mapping to populate promotion_discount_with_tax field.
Parameters
| Parameter | Type | Description |
|---|---|---|
appliedReductions | AppliedReduction[] | Array of applied price reductions. |
Returns
| Property | Type | Description |
|---|---|---|
| Returns | CentAmount | undefined | Promotion discount amount in cents, or undefined if no promotion reduction found. |
formatPrice()
Converts price from cents to currency units. Used in price mapping to format tracking prices for ecommerce events.
Parameters
| Parameter | Type | Description |
|---|---|---|
price | CentAmount | number | undefined | Price in cents. |
Returns
| Property | Type | Description |
|---|---|---|
| Returns | CentAmount | undefined | Price in currency units, or undefined if price is not provided. |
getEcommercePrice()
Maps a price object to ecommerce tracking item price fields. Used in product, variant, and basket item mapping to populate price-related tracking data.
Parameters
| Parameter | Type | Description |
|---|---|---|
price | Price | BasketItemPrice | OrderPrice | Price or basket item price object with applied reductions. |
Returns
| Property | Type | Description |
|---|---|---|
| Returns | Pick<TrackingEcommerceItem, 'price_with_tax' | 'original_price_with_tax' | 'sale_discount_with_tax' | 'campaign_discount_with_tax' | 'promotion_discount_with_tax' | 'tax'> | Object containing formatted price fields for ecommerce tracking. |
mapPromotionToEcommerceItem()
Maps a promotion to an ecommerce item.
Parameters
| Parameter | Type | Description |
|---|---|---|
promotion | Promotion | The promotion to map. |
Returns
| Property | Type | Description |
|---|---|---|
| Returns | TrackingEcommerceItem | The ecommerce item. |
mapCampaignToEcommerceItem()
Maps a campaign to an ecommerce item.
Parameters
| Parameter | Type | Description |
|---|---|---|
campaign | Campaign | The campaign to map. |
Returns
| Property | Type | Description |
|---|---|---|
| Returns | TrackingEcommerceItem | The ecommerce item. |
sumPromotionReductionsFromAllOrderItems()
Calculates the total promotion discount amount across all order items. Used in purchase event tracking to populate promotion_reduction_with_tax field.
Parameters
| Parameter | Type | Description |
|---|---|---|
orderItems | Order['items'] | Array of order items from an order. |
Returns
| Property | Type | Description |
|---|---|---|
| Returns | number | Total promotion discount amount in cents. |
sumCampaignReductionsFromAllOrderItems()
Calculates the total campaign discount amount across all order items. Used in purchase event tracking to populate campaign_reduction_with_tax field.
Parameters
| Parameter | Type | Description |
|---|---|---|
orderItems | Order['items'] | Array of order items from an order. |
Returns
| Property | Type | Description |
|---|---|---|
| Returns | number | Total campaign discount amount in cents. |
sumSaleReductionsFromAllOrderItems()
Calculates the total sale discount amount across all order items. Used in purchase event tracking to populate sale_reduction_with_tax field.
Parameters
| Parameter | Type | Description |
|---|---|---|
orderItems | Order['items'] | Array of order items from an order. |
Returns
| Property | Type | Description |
|---|---|---|
| Returns | number | Total sale discount amount in cents. |
mapOrderItemToEcommerceItem()
Maps an order item to an ecommerce tracking item. Used in purchase event tracking to populate items array with order item data.
Parameters
| Parameter | Type | Description |
|---|---|---|
item | OrderItem | Order item to map. |
Returns
| Property | Type | Description |
|---|---|---|
| Returns | TrackingEcommerceItem | Ecommerce tracking item with product, variant, price, and category data. |
getPromotionIdsFromOrder()
Extracts unique promotion IDs from all order items. Used in purchase event tracking to populate promotions field in ecommerce payload.
Parameters
| Parameter | Type | Description |
|---|---|---|
order | Order | Order object containing items with promotions. |
Returns
| Property | Type | Description |
|---|---|---|
| Returns | string[] | Array of unique promotion IDs, or empty array if no promotions found. |
getEcommerceCategories()
Extracts the names of up to 5 categories from a nested array of product categories. Used in product mapping to populate item_category, item_category2, and item_category3 fields.
Parameters
| Parameter | Type | Description |
|---|---|---|
categories | ProductCategory[][] | undefined | Nested array of product categories. |
Returns
| Property | Type | Description |
|---|---|---|
| Returns | Pick<TrackingEcommerceItem, 'item_category' | 'item_category_id' | 'item_category2' | 'item_category2_id' | 'item_category3' | 'item_category3_id' | 'item_category4' | 'item_category4_id' | 'item_category5' | 'item_category5_id'> | Array of up to 5 categories with their names and IDs. |
getEcommerceAttributesForVariant()
Extracts variant attributes for ecommerce tracking. Used in product, variant, and basket item mapping to populate attribute-related tracking fields.
Parameters
| Parameter | Type | Description |
|---|---|---|
variant | Variant | OrderVariant | Optional variant to extract size attribute from. |
Returns
| Property | Type | Description |
|---|---|---|
| Returns | Partial<TrackingEcommerceItem> | Object containing item_name, item_brand, item_brand_id, and item_size fields. |
getEcommerceAttributesForProduct()
Extracts product attributes for ecommerce tracking. Used in product, variant, and basket item mapping to populate attribute-related tracking fields.
Parameters
| Parameter | Type | Description |
|---|---|---|
product | Product | OrderProduct | Product to extract attributes from. |
Returns
| Property | Type | Description |
|---|---|---|
| Returns | Partial<TrackingEcommerceItem> | Object containing item_name and item_brand fields. |