The
fidero.init()
method is asynchronous. It kicks off the process of fetching your configuration and getting the SDK ready. All subsequent API calls (like page
or track
) are safely queued and will be processed in order once initialisation is complete.You can wait for the SDK to be fully loaded using await fidero.init()
or by using the global fidero.ready.then()
handler. This is only necessary if you need to access SDK properties, like the fidero.Event
constants, immediately after initialisation.Methods
init()
Initialises the SDK. This should be the first method called to ensure the SDK is configured correctly. The installation snippet calls this for you.
Your unique project identifier, provided during onboarding.
An object containing initial identity or configuration overrides.
page()
Tracks a page view. The installation snippet calls this once on initial page load. For Single-Page Applications (SPAs), you must call this method again after each route change.
An object containing a
properties
key, which can be used to send custom
properties with the page view and to override any automatically captured page
data (e.g. page_title
, page_url
).track()
Tracks a custom event.
An object containing the event details.
updateIdentity()
Updates the current visitor’s identity profile.
An object containing the identity fields to update.
getIdentity()
Returns the current identity stored in the SDK (anonymousId
, userId
, traits
).
updateConsent()
Updates the visitor’s consent preferences. If you are using a custom consent solution, you must call this method on every page load to ensure the SDK is initialised with the correct consent state.
An object where keys are consent categories (e.g.
advertising
, analytics
)
and values are booleans.getConsent()
Returns the current consent state stored in the SDK.
reset()
Resets the current user’s identity. This is an asynchronous operation that clears the userId
and traits
and generates a new anonymousId
. It is useful for “log out” functionality.
Event Helpers
The Pixel SDK provides thefidero.Event
object as a convenient helper to ensure you use standardised event names and avoid typos.
See the Common Data Schema for a full description of each event.
Key Name (fidero.Event ) | Event Name (string) |
---|---|
LEAD_FORM_COMPLETED | lead_form_completed |
SIGNUP_COMPLETED | signup_completed |
USER_LOGGED_IN | user_logged_in |
SEARCH_PERFORMED | search_performed |
ITEM_LIST_VIEWED | item_list_viewed |
ITEM_VIEWED | item_viewed |
ITEM_ADDED | item_added |
CHECKOUT_STARTED | checkout_started |
PAYMENT_INFO_ADDED | payment_info_added |
PURCHASE_COMPLETED | purchase_completed |
TRIAL_STARTED | trial_started |
SUBSCRIPTION_STARTED | subscription_started |
SUBSCRIPTION_CANCELLED | subscription_cancelled |