Set Customer Info

When the App opens or when the user logs in, fire the following event so that user information is associated with all the tags

The setCustomerInfo method only needs to be invoked once when the user has logged in and you have the customer information that can be set. Once set, it will continue to be passed along to all the other events. When the app re-opens, this needs to be invoked again.

Copy

MagicPixel.setCustomerInfo({
    phone_number: '<phone number>',     // mandatory
    country_code: 1, // mandatory
    first_name: '<first name if available>', // full name split by space and part[0], optional
    last_name: '<last name if available>', // full name split by space and part[1], optional
    city: '<lower case city name>', // lower case, no space, optional
    state: '<lower case no space state name>', // lower case, no space, optional
    country: 'in', // hardcoded to in
});

When the customer logs in fire the following event

Copy

MagicPixel.recordEvent('login', {
    method: 'phone'
});

For GA4 to work properly in the backend, set the firebase app instance id as below when the app opens

Copy

If using RNFirebase library, the app instance id can be fetched as detailed in the below link.

LogoAnalytics | React Native FirebaseReact Native Firebase

Fetching App Instance Id

Example

Copy

PreviousSet Device Info NextPage Load

Last updated 9 minutes ago