docs
  1. Features
  2. Analytics & Tracking
  3. Composables

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

PropertyTypeDescription
current_page_pathstring | undefinedCurrent page URL path.
current_page_typePageType | undefinedCurrent page type identifier (e.g., 'pdp', 'category', 'basket').
previous_page_pathstring | undefinedPrevious page URL path (optional, set during navigation).
previous_page_typePageType | undefinedPrevious page type identifier (optional, set during navigation).
interaction_sourceTrackingInteractionSource | undefinedSource 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

PropertyTypeDescription
shop_idnumberShop identifier number (unique shop ID from SCAYLE).
shop_currencystringShop currency code (ISO 4217 format, e.g., 'EUR', 'USD').
localestringLocale identifier (e.g., 'de-DE', 'en-US').
shop_versionstringApplication version string.
landing_pagestringAbsolute URL of the first page visited in this session.
parameterstringRaw query string from the landing page (includes utm_* parameters).
referrerstring | undefinedFirst external referrer URL (optional, only set if user came from external site).
customer_idstring | undefinedCustomer identifier (optional, only set for logged-in users).
customer_typeTrackingCustomerType | undefinedCustomer classification (optional, 'guest', 'new', or 'existing').
customer_groupsstring[] | undefinedCustomer group identifiers (optional, array of group names).
loginbooleanWhether user is logged in (defaults to false for guests).
login_methodAuthenticationType | undefinedAuthentication method used (optional, e.g., 'password').
ehstring | undefinedSHA256 hash of user email (optional, never raw email, used for analytics).

CheckoutEvent

Checkout event used for tracking with Google Tag Manager.

Properties

PropertyTypeDescription
action'authenticated' | undefinedAction type.
type'tracking' | undefinedEvent type.
userShopUserUser information.
accessTokenstringThe OAuth 2.0 access token for the authenticated user.
eventCartEvent | CompleteCheckoutEvent | PaymentInfoEvent | ShippingInfoEvent | undefinedDetails 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

PropertyTypeDescription
item_idstring | undefinedUnique product identifier (e.g., SKU, product ID).
item_namestring | undefinedProduct name or title.
price_with_taxCentAmount | undefinedNet item unit price in shop currency.
original_price_with_taxCentAmount | undefinedGross item unit price in shop currency.
quantitynumber | undefinedQuantity of items.
currencystring | undefinedCurrency code (ISO 4217 format, e.g., 'EUR', 'USD').
item_brandstring | undefinedBrand name.
item_brand_idstring | undefinedBrand identifier.
item_sizestring | undefinedProduct size (e.g., 'M', '42', 'Large').
indexnumber | undefinedPosition index in list (0-based).
sold_outboolean | undefinedWhether the item is sold out.
item_categorystring | undefinedFirst category name of the category list for the product.
item_category_idstring | undefinedFirst category identifier of the category list for the product.
item_category2string | undefinedSecond category name of the category list for the product.
item_category2_idstring | undefinedSecond category identifier of the category list for the product.
item_category3string | undefinedThird category name of the category list for the product.
item_category3_idstring | undefinedThird category identifier of the category list for the product.
item_category4string | undefinedFourth category name of the category list for the product.
item_category4_idstring | undefinedFourth category identifier of the category list for the product.
item_category5string | undefinedFifth category name of the category list for the product.
item_category5_idstring | undefinedFifth category identifier of the category list for the product.
item_list_namestring | undefinedList name where item appears (e.g., 'Search Results', 'You May Also Like').
taxCentAmount | undefinedTax amount for this individual item (in shop currency).
sale_discount_with_taxCentAmount | undefinedDiscount amount from sale pricing including tax.
campaign_discount_with_taxCentAmount | undefinedDiscount amount from campaign pricing including tax.
promotion_discount_with_taxCentAmount | undefinedDiscount amount from promotion pricing including tax.
promotion_idstring | undefinedUnique promotion identifier applied to this item.
promotion_namestring | undefinedInternal promotion name (not displayed to users).
promotion_display_namestring | undefinedPromotion display name shown to users.
promotion_linkstring | undefinedPromotion link URL.
promotionsstring[] | undefinedArray 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

PropertyTypeDescription
itemsTrackingEcommerceItem[] | undefinedArray of ecommerce items included in the tracking event.
transaction_idstring | undefinedUnique order or transaction reference number (e.g., order ID from checkout).
customer_idstring | undefinedCustomer account identifier.
valuenumber | undefinedTotal basket value including tax and discounts.
sale_reduction_with_taxnumber | undefinedTotal discount amount from sale pricing including tax.
campaign_reduction_with_taxnumber | undefinedTotal discount amount from campaigns including tax.
promotion_reduction_with_taxnumber | undefinedTotal discount amount from promotions including tax.
promotionsstring[] | undefinedArray of promotion identifiers applied to the entire basket or transaction.
taxnumber | undefinedTotal tax amount for the entire transaction.
shippingnumber | undefinedShipping cost for the order.
currencystring | undefinedCurrency code for all monetary values (ISO 4217 format, e.g., 'EUR', 'USD').
payment_typestring | undefinedPayment 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

PropertyTypeDescription
eventTrackingEventNameType of tracking event being sent.
pageTrackingPageContextPage-level context for the current page and navigation.
sessionTrackingSessionContextSession-level context with shop, user, and session metadata.
ecommerceTrackingEcommercePayload | undefinedEcommerce data with items (optional, used for cart, purchase, etc.).
[customKey: string]unknownAdditional 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

PropertyTypeDescription
push(data: Partial<TrackingEvent>) => voidPushes 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

PropertyTypeDescription
pageComputedRef<Omit<TrackingPageContext, 'interaction_source'>>Current and previous page tracking data (path and type).
sessionComputedRef<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

PropertyTypeDescription
previousPageContextRef<Pick<TrackingPageContext, 'previous_page_path' | 'previous_page_type'>>Reactive state for previous page path and type.
currentPageContextRef<Pick<TrackingPageContext, 'current_page_path' | 'current_page_type'>>Reactive state for current page path and type.
initialPageRef<string>Reactive state for the landing page URL.
setPreviousPageContext(pagePath: string, pageType: PageType) => voidUpdates the previous page context.
setCurrentPageContext(pagePath: string, pageType: PageType) => voidUpdates the current page context.
setInitialPage(pagePath: string) => voidUpdates the landing page URL.

useGlobalEvents()

Composable for tracking global events.

Returns

PropertyTypeDescription
trackContentView(data?: Partial<TrackingEvent>) => voidTracks content view events.
trackShopInitialization() => voidTracks shop initialization.
trackError({ code?: number, message: string }) => voidTracks error events.
trackShopSwitch() => voidTracks 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

PropertyTypeDescription
trackBasket(cost?: BasketTotalPrice, items?: BasketItem[]) => voidTracks basket state with cost and items.
trackAddToBasket(variant: Variant, product: Product, quantity?: number, interactionSource?: TrackingInteractionSource) => voidTracks when items are added to the basket.
trackRemoveFromBasket(item: BasketItem, interactionSource?: TrackingInteractionSource) => voidTracks when items are removed from the basket.
trackViewCart(basketItems?: BasketItem[]) => voidTracks 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

PropertyTypeDescription
trackBeginCheckout(cost?: BasketTotalPrice, checkoutType?: 'regular' | 'express') => voidTracks checkout initiation.
trackAddShippingInfo(shippingType: string, shippingMethod: string, currency: string, value: number, basketItems?: BasketItem[]) => voidTracks shipping method selection.
trackAddPaymentInfo(paymentType: PaymentOptionKey, basketItems?: BasketItem[]) => voidTracks payment method selection.
trackCompleteCheckout(basketItems: BasketItem[]) => voidTracks 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

PropertyTypeDescription
trackViewItem(product?: Product | null, variant?: Variant) => voidTracks when a product is viewed.
trackSelectItem(product: Product, itemListName?: string, index?: number) => voidTracks when a product is selected (clicked).
trackViewItemList(products: Product[], itemListName?: string, searchTerm?: string) => voidTracks 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

PropertyTypeDescription
trackSignUp(successful: boolean) => voidTracks sign-up attempts with success status.
trackLogin(successful: boolean) => voidTracks login attempts with success status.
trackLogout() => voidTracks logout events.

useSearchEvents()

Composable for tracking search events.

Returns

PropertyTypeDescription
trackSearch({ query: string, suggestion: SearchEntity | 'show_all' }) => voidTracks search events.
getSearchDestination(query: string, suggestion: SearchEntity | 'show_all') => string | undefinedGets 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

PropertyTypeDescription
trackApplyFilter(type: string, value: string | boolean | number) => voidTracks when a filter is applied.
trackRemoveFilter(type: string, value: string | boolean) => voidTracks when a filter is removed.
trackResetFilter(type: string, value: string | boolean) => voidTracks when a filter is reset.
trackSorting(value: TrackingSorting) => voidTracks when sorting is changed.

usePromotionEvents()

Composable for tracking promotion events.

Returns

PropertyTypeDescription
trackViewPromotion(promotions: Promotion[]) => voidTracks when promotions are viewed.
trackViewCampaign(campaign: Campaign) => voidTracks when campaigns are viewed.
trackSelectPromotion(promotion: Promotion) => voidTracks when a promotion is selected.
trackSelectCampaign(campaign: Campaign) => voidTracks 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

PropertyTypeDescription
trackWishlist(items?: WishlistItem[]) => voidTracks wishlist state with items.
trackAddToWishlist(product: Product, itemListName?: string) => voidTracks when items are added to the wishlist.
trackRemoveFromWishlist(product: Product, itemListName?: string) => voidTracks 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

PropertyTypeDescription
trackPurchase(order: Order) => voidTracks 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

ParameterTypeDescription
basketItemBasketItemThe basket item to map.

Returns

PropertyTypeDescription
ReturnsTrackingEcommerceItemThe ecommerce item.

mapProductToTracking()

Maps a product to an ecommerce item. Used in product event tracking to map products to ecommerce items.

Parameters

ParameterTypeDescription
productProductThe product to map.

Returns

PropertyTypeDescription
ReturnsTrackingEcommerceItemThe ecommerce item.

mapVariantToTracking()

Maps a variant to an ecommerce item. Used in product event tracking to map variants to ecommerce items.

Parameters

ParameterTypeDescription
variantVariantThe variant to map.

Returns

PropertyTypeDescription
ReturnsTrackingEcommerceItemThe ecommerce item.

getSalePriceFromAppliedReductions()

Extracts the sale discount amount from applied reductions. Used in price mapping to populate sale_discount_with_tax field.

Parameters

ParameterTypeDescription
appliedReductionsAppliedReduction[]Array of applied price reductions.

Returns

PropertyTypeDescription
ReturnsCentAmount | undefinedSale 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

ParameterTypeDescription
appliedReductionsAppliedReduction[]Array of applied price reductions.

Returns

PropertyTypeDescription
ReturnsCentAmount | undefinedCampaign 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

ParameterTypeDescription
appliedReductionsAppliedReduction[]Array of applied price reductions.

Returns

PropertyTypeDescription
ReturnsCentAmount | undefinedPromotion 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

ParameterTypeDescription
priceCentAmount | number | undefinedPrice in cents.

Returns

PropertyTypeDescription
ReturnsCentAmount | undefinedPrice 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

ParameterTypeDescription
pricePrice | BasketItemPrice | OrderPricePrice or basket item price object with applied reductions.

Returns

PropertyTypeDescription
ReturnsPick<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

ParameterTypeDescription
promotionPromotionThe promotion to map.

Returns

PropertyTypeDescription
ReturnsTrackingEcommerceItemThe ecommerce item.

mapCampaignToEcommerceItem()

Maps a campaign to an ecommerce item.

Parameters

ParameterTypeDescription
campaignCampaignThe campaign to map.

Returns

PropertyTypeDescription
ReturnsTrackingEcommerceItemThe 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

ParameterTypeDescription
orderItemsOrder['items']Array of order items from an order.

Returns

PropertyTypeDescription
ReturnsnumberTotal 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

ParameterTypeDescription
orderItemsOrder['items']Array of order items from an order.

Returns

PropertyTypeDescription
ReturnsnumberTotal 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

ParameterTypeDescription
orderItemsOrder['items']Array of order items from an order.

Returns

PropertyTypeDescription
ReturnsnumberTotal 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

ParameterTypeDescription
itemOrderItemOrder item to map.

Returns

PropertyTypeDescription
ReturnsTrackingEcommerceItemEcommerce 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

ParameterTypeDescription
orderOrderOrder object containing items with promotions.

Returns

PropertyTypeDescription
Returnsstring[]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

ParameterTypeDescription
categoriesProductCategory[][] | undefinedNested array of product categories.

Returns

PropertyTypeDescription
ReturnsPick<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

ParameterTypeDescription
variantVariant | OrderVariantOptional variant to extract size attribute from.

Returns

PropertyTypeDescription
ReturnsPartial<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

ParameterTypeDescription
productProduct | OrderProductProduct to extract attributes from.

Returns

PropertyTypeDescription
ReturnsPartial<TrackingEcommerceItem>Object containing item_name and item_brand fields.