PelcroSiteLoaded
Fired when site configuration is loaded
Overview
Fired when the site configuration is successfully loaded from the API. After this event, most SDK APIs are available, but user session may not yet be restored.
When It Fires
This event fires during boot, after:
- Fingerprint detection complete
- Bot detection passed
- Site API call returns
But before:
- User session restoration
- E-commerce initialization
- Paywall initialization
Event Detail
The event.detail object contains the site configuration:
| Property | Type | Description |
|---|---|---|
id | number | Site ID |
name | string | Site name |
default_currency | string | Default currency code |
settings | string | Site mode (subscription, anti-adblock, analytics-only) |
ecommerce_enabled | boolean | Whether e-commerce is enabled |
plans | array | Available subscription plans |
products | array | Available products |
Example
document.addEventListener('PelcroSiteLoaded', (event) => {
const site = event.detail;
console.log(`Site loaded: ${site.name}`);
console.log(`Currency: ${site.default_currency}`);
// Check available plans
if (site.plans?.length > 0) {
console.log(`${site.plans.length} plans available`);
}
});Use Cases
- Displaying site-specific branding
- Checking available plans before showing pricing
- Determining site mode for conditional logic
Related
- Events Overview - All available events
- PelcroBootComplete - Fires when SDK is fully ready
- Site Module - Methods for accessing site data
Updated 1 day ago
