Events

SDK events for tracking initialization and user actions

Overview

The SDK fires custom DOM events at two distinct times:

  1. Boot-time events - Fire during SDK initialization
  2. User-action events - Fire in response to user interactions

Understanding this distinction helps you integrate correctly. Boot-time events tell you when features are ready; user-action events let you respond to user behavior.


Listening to Events

document.addEventListener('PelcroUserLoggedIn', (event) => {
  const user = event.detail;
  console.log('User logged in:', user.email);
});

All events follow this pattern:

  • Events are dispatched on document
  • Event data is available in event.detail
  • Events bubble and are not cancelable

Boot-Time Events

These events fire during SDK initialization. Use them to know when features are ready.

EventDescription
PelcroFingerprintReadyDevice fingerprinting complete
PelcroSiteLoadedSite configuration loaded, most APIs ready
PelcroUserLoadedUser session restored (fires on every user data update)
PelcroEcommerceProductsLoadedE-commerce products loaded
PelcroBootCompleteSDK fully initialized, all features ready

AdBlock Detection Events

EventDescription
PelcroAdBlockDetectedAd blocker is active
PelcroAdBlockDisabledNo ad blocker detected
PelcroAdBlockTestCompleteAd blocker detection test finished

User-Action Events

These events fire in response to user interactions or API calls.

User Events

EventDescription
PelcroUserRegisterNew user account created
PelcroUserLoggedInUser successfully authenticated
PelcroUserLogoutUser logged out
PelcroUserUpdatedUser profile updated
PelcroUserRefreshUser session refreshed
PelcroEmailVerifiedEmail verification completed
PelcroMetadataUpdatedUser metadata saved

Subscription Events

EventDescription
PelcroSubscriptionCreateNew subscription created
PelcroSubscriptionCancelSubscription canceled
PelcroSubscriptionRenewedSubscription renewed
PelcroSubscriptionReactivatedCanceled subscription reactivated
PelcroSubscriptionUpdatedSubscription modified
PelcroGiftRedeemedGift subscription redeemed

Payment Events

EventDescription
PelcroSourceCreatedPayment source added
PelcroSourceUpdatedPayment source updated
PelcroPaymentMethodCreatedPayment method added
PelcroPaymentMethodUpdatedPayment method updated
PelcroPaymentMethodDeletedPayment method removed
PelcroInvoicePayInvoice paid

Address Events

EventDescription
PelcroAddressCreatedNew address added
PelcroAddressUpdatedAddress modified

Password Events

EventDescription
PelcroPasswordForgotPassword reset requested
PelcroPasswordResetPassword reset completed
PelcroPasswordUpdatePassword changed

Newsletter Events

EventDescription
PelcroNewsletterCreatedNewsletter subscription created

E-commerce Events

EventDescription
PelcroOrderCreatedOrder placed

Paywall Events

These events can fire during boot (automatic paywall) or at runtime (manual trigger).

EventDescription
PelcroPaywallMatchContent matches a paywall rule
PelcroPaywallDisplayedPaywall shown to user
PelcroPaywallNotDisplayedPaywall skipped (user has access)

Deprecated Events

These events still work but should not be used in new integrations.

Deprecated EventUse Instead
PelcroUserLoginPelcroUserLoggedIn
PelcroOrderCreatePelcroOrderCreated

Related