The Fidero JavaScript SDK, also known as the Pixel, provides a simple API for tracking events and managing user identity and consent from your website’s frontend.
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.
fidero.init(projectId, [options])
projectId
string
required
Your unique project identifier, provided during onboarding.
options
Object
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.
fidero.page([params])
params
Object
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.
fidero.track(event)
event
Object
required
An object containing the event details.

updateIdentity()

Updates the current visitor’s identity profile.
fidero.updateIdentity(identity)
identity
Object
required
An object containing the identity fields to update.

getIdentity()

Returns the current identity stored in the SDK (anonymousId, userId, traits).
const identity = fidero.getIdentity()

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.
fidero.updateConsent(consent)
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.
const consent = fidero.getConsent()

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.
await fidero.reset()

Event Helpers

The Pixel SDK provides the fidero.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_COMPLETEDlead_form_completed
SIGNUP_COMPLETEDsignup_completed
USER_LOGGED_INuser_logged_in
SEARCH_PERFORMEDsearch_performed
ITEM_LIST_VIEWEDitem_list_viewed
ITEM_VIEWEDitem_viewed
ITEM_ADDEDitem_added
CHECKOUT_STARTEDcheckout_started
PAYMENT_INFO_ADDEDpayment_info_added
PURCHASE_COMPLETEDpurchase_completed
TRIAL_STARTEDtrial_started
SUBSCRIPTION_STARTEDsubscription_started
SUBSCRIPTION_CANCELLEDsubscription_cancelled