Set of methods allow eitri shopping apps to use Firebase native code methods. Through these methods, it is possible to log events, errors, crashes, the name of screens where functions have been called and it's class set an user's ID and set user properties.

Methods

  • Logs an app event in Firebase. The event can have up to 25 parameters, each being represented by the key-value pairs contained in the data object.

    Example:

    await Eitri.exposedApis.fb.logEvent({eventName: "event", data: {appLanguage: "en-US"}})
    

    Parameters

    • param: { eventName: string; data: Record<string, string | number> }

      Object describing the event.

      • eventName: string

        Name of the event.

        Firebase dictates it must contain 1 to 40 alphanumeric characters or udndescores and start with an alphabetic character.

      • data: Record<string, string | number>

        Object describing the event's data.

        Keys for a parameter's name can be up to 40 characters long, must start with an alphabetic character and contain only alphanumeric characters and underscores, as dictated by Firebase.

        The value for a key can be up to 100 characters long if it is a string.

    Returns Promise<undefined>

  • Logs a error message in Firebase.

    await Eitri.exposedApis.fb.logError({message: "Error message"})
    

    Parameters

    • param: { message: string }

      Object for future destructuring containing the message of the error as it's single attribute

      • message: string

        The message of the error.

    Returns Promise<undefined>

  • Logs a crash message in Firebase. This API is avaliable to maintain retrocompatibility with legacy code. It's internal implementation is the same as implementation for logError.

    await Eitri.exposedApis.fb.crashLog({message: "App Crashed"})
    

    Parameters

    • param: { message: string }

      Object for future destructuring containing the message of the error as it's single attribute

      • message: string

        The message of the error.

    Returns Promise<undefined>

  • Logs screen_view events in Firebase, sending the name of the screen and it's class.

    await Eitri.exposedApis.fb.setUserProperty({key: "age", value: "23"})
    

    Parameters

    • param: { screen: string; screenClass: string }

      Object for future destructuring containing the name of the screen and it's class.

      • screen: string

        Name of the screen.

      • screenClass: string

        Name of the class that represents the screen.

    Returns Promise<undefined>

  • Sets the user ID property.

    await Eitri.exposedApis.fb.setUserId({id: "123456"})
    

    Parameters

    • param: { id: string }

      Object containing an 'id' attribute for future destructuring.

      • id: string

        ID property for the user.

    Returns Promise<undefined>

  • Sets a user property.

    await Eitri.exposedApis.fb.setUserProperty({key: "age", value: "23"})
    

    Parameters

    • param: { key: string; value: string }

      Object containing key/value pairs for future destructuring.

      • key: string

        Name for the user's property.

      • value: string

        Value for the user's property of name defined in param.key.

    Returns Promise<undefined>