Skip to main content
Important Notice:If the new architecture is enabled in a React Native application, use SDK version 1.3.0 or higher with the required new architecture configurations. If you experience issues with a higher version, contact our support team at support@zeotap.com.

Latest Version

1.3.3

Overview

React Native is a popular JavaScript framework for building mobile applications. It allows developers to write code once and deploy it on multiple platforms, such as iOS and Android. This section addresses the integration of the zeo-collect package into your React Native project, the setup of Android and iOS SDKs and the configuration of the package to receive events.

Get Started

To start with, you have to create Android and iOS sources in the Collect application within Zeotap and obtain the write_keys for the same. Once done, you can then integrate the zeo-collect package into your React Native project as follows:
  1. Integrate the zeo-collect Package
  2. Set up Zeotap Android SDK
  3. Set up Zeotap iOS SDK
  4. Configure the React Native Package
  5. Send Events to Zeotap

Step 1 - Integrate zeo-collect Package

Perform the following steps to integrate the zeo-collect package into your React Native project:
1
Run the following command from the primary directory of the project:npm install zeo-collect
2
Check for the package.json file in your project’s package and verify that the zeo-collect package is included within the dependencies section.

Step 2 - Set up Zeotap Android SDK

Next, you have to set up the ZeotapCollect Android SDK using the Dependency Manager. To do so, perform the following steps:
Note:The Android SDK version and the Gradle tool version mentioned in the integration steps are for reference purposes only. Ensure to use the latest version during the setup process.
1
At the project level of the build.gradle file or settings.gradle file (Project root > build.gradle or Project root > settings.gradle), add the Maven URL given below in the repositories block:
Code
repositories {       
google()     
maven {                  
url 'https://sdk.zeotap.com/android-sdk'        
      } 
}
2
In the app level build.gradle file (Project root > app > build.gradle), add the following in the ​dependencies ​​block:
Code
dependencies {     
implementation "com.zeotap:zeo-collect:2.1.1"     
.     
.     
. 
}
3
Add the following compile options to ​the android​ block at the app level build.gradle file.
Code
android {
  ...
  compileOptions {    
    sourceCompatibility JavaVersion.VERSION_1_8    
    targetCompatibility JavaVersion.VERSION_1_8
  }
}
4
If you have obtained the AdID yourself, then you can use the setAdID method to apply it. However, if you prefer the SDK to retrieve the AdID, then perform the following steps:a. For applications targeting Android version 13 or higher, include the following dependency in the app-level dependency block:
dependencies {
implementation "com.google.android.gms:play-services-ads:20.4.0"
}
b. For applications targeting Android versions lower than 13, the SDK automatically retrieves the AdID on its own.
5
Ensure that you add following dependency in app level dependency block, if you are not using json dependency in your project.
dependencies {
implementation "com.google.code.gson:gson:2.10.1"
}
6
Do clean from Build > Clean Project.
7
Sync the project with the gradle files and rebuild from Build > Rebuild Project.

Step 3 - Set up iOS SDK

Next, perform the following steps to set up the ZeotapCollect iOS SDK using Cocoa Pods:
Note:To ensure whether CocoaPods is installed in your system or not, follow the instructions below:
  • To check if CocoaPods is installed, run the command pod --version. With CocoaPods installed, you can see the version number displayed, as shown in the image below.
  • If CocoaPods is not installed, then you can add it to your project by following the instructions at https://guides.cocoapods.org/using/using-cocoapods.html.
Once CocoaPods is installed in your system, perform the following steps to integrate ZeotapCollect iOS SDK:
1
Navigate to the iOS directory within your project and execute the command cd ios to access the iOS folder from the project root:
2
Run the command pod install. This identifies and installs the dependencies.
3
Once installed, open the yourApplication.xcworkspace file in Xcode. Note that you can find this file at yourApplication/ios/yourApplication.xcworkspace.
Note:Ensure to close any other Xcode applications related to this project, such as the xcodeproj app.

Step 4 - Configure the React Native Package

Once you have successfully set up Zeotap Android and iOS SDKs, you can configure the React Native package by performing the following steps:
  • Initialise the Zeo-collect package by passing the options object in the initialiseZeoCollect function. Note that the options object must include the required package options (settings) as key-value pairs. The function also accepts an optional callback parameter, which receives a data object containing {status, message} and executes the implementation.
  • Invoke the initialiseZeoCollect function from your app’s entry point, within the useEffect hook in the App.js file as shown in the example below.
Code
import {initialiseZeoCollect} from 'zeo-collect';  

const App: () => React$Node = () => {   
     const {persistor, store} = storePre;       
           useEffect(() => {       
           const options = {"android_write_key":"1b19b1c2-dcfc-497e-8d86-8d38cd183c5b",                        
                            "ios_write_key":"1b19b1c2-dcfc-497e-8d86-8d38cd183c5b",                         
                            "batch_size": 17,                         
                            "opt_out":false,                         
                            "service_interval": 50,                         
                            "use_consent": false,                         
                            "check_for_cmp":false,                         
                            "user_country": "ind" }         
            initialiseZeoCollect(options);         
            
            // initialiseZeoCollect with callback
            // initialiseZeoCollect(options, (data) -> {console.log("Initialisation status", data);});
            ...
            }, []);   
            return (     
                <Provider store={store}>     
                // ...
                </Provider>   
            ); 
};

Note:Ensure that the key names are used exactly as provided in the table below. Note that the write_keys are of the data type String only.
The following table provides information about the Key names, data types and descriptions of the options involved in configuring the zeo-collect package:
Key NameValue Data TypeDescription
android_write_keyStringThis is the Android write key generated after you create an Android source.
ios_write_keyStringThis is the iOS write key generated after you create an iOS source.
batch_sizeIntegerThis is the maximum number of events allowed to remain in the unsent queue when scheduling an event. If the event exceeds this threshold, then the next batch is dispatched immediately.

The default value is 30.
The minimum value for the batch size is 10 and the maximum value can be 50.
service_intervalIntegerThis is the time interval for scheduling events. If the size of the queue is less than the threshold, then the request to post events is scheduled after the service interval.

The default value is 90 seconds.
max_cache_sizeIntegerThis is the maximum number of events allowed to be stored in the local memory in case of network issue or delayed consent.

The default value is 100 and the maximum value can be 200.
opt_outBooleanThis option acts as a fallback when consent is not used. If set to true, then no events are posted to Zeotap.

The default value is false.
use_consentBooleanThis option manages actions based on the based on received consent.
check_for_cmpBooleanThis option manages consents based on the CMP data. If check_for_cmp is set to true along with use_consent, then you can look for CMP data stored by other CMPs. Subsequently, you can manage consents based on this CMP data.
are_identities_hashedBooleanThis option indicates whether the identities shared in setUserIdentities are hashed or not.

The default value is false.
hash_identitiesBooleanThis option indicates whether or not the hashing of the raw identities is required.

The default value is false.
check_zeotap_vendor_consentBooleanIf this option is set to true, then the package checks for Zeotap Vendor consent, while resolving GDPR consent to send the data. If set to false, then the package ignores the Zeotap Vendor consent.

The default value is false.
loggingBooleanIf set to true, then it displays the info, debug, warning and error log severity levels. Otherwise, it only displays the warning and error log severity levels.
purposes_for_trackingList/Array of IntegersThis option is used to pass a list of purpose IDs, based on which you can manage the consent for tracking.
To know more about the purposes for tracking and the associated IDs, refer to the “Appendix A: Purposes and Features Definitions” section of this topic.
purposes_for_identifyList/Array of IntegersThis option is used to pass a list of purpose IDs, based on which you can manage the consent for identification.
To know more about the purposes for identification and the associated IDs, refer to the “Appendix A: Purposes and Features Definitions” section of this topic.
user_countryStringThis option determines the region where the data is stored. Note that you have to set this in alpha-iso3 codes.
The API defaults the IP to determine the country if the user country is missing.

Step 5 - Send Events to Zeotap

Perform the following steps to send events to Zeotap using the zeo-collect package:
1
Import the necessary functions from the zeo-collect package into the relevant files.
2
Invoke the appropriate function with the required arguments where you want the event data to be collected as mentioned in the examples below.
Note:Ensure to replace the placeholders such as name, description, price and more with actual variables containing the relevant data you wish to send with the events. The functions of the zeo-collect package allow you to capture and transmit event-specific information to Zeotap for analysis and tracking.
Examples
  • Using the setEventNameProperties function:
Code
import { setEventNameProperties } from 'zeo-collect';  
// ... 
// Inside your component 
return (   
    <Button title="Primary Button" onPress={() => setEventNameProperties("primary_button_clicked")} /> 
);
  • Using the setEventProperties function:
Code
import { setEventProperties } from 'zeo-collect';  
// ... 
// Inside your component 
return (   
     <Button title="Primary Button" onPress={() => setEventProperties("primary_button_clicked", { name, description, price })} />
);
  • Using the setEventProperties function along with other methods:
Code
import { setEventProperties, setPageProperties } from 'zeo-collect';  
// ... 
// Inside your component 
const _renderBottom = () => {   
return (     
    <BottomButtons       
    onPress={() => {         
    setPageProperties({ page: "Product Detail" });         
    setEventProperties("Add To Cart", { name, price, size, color, quantity: 1 });         o
    nAddToCart();         
    navigation.navigate('Cart');       
    }}     
  />   
 ); 
};

Methods Available in the zeo-collect Package

The following methods are available in the zeo-collect package:
METHODSPARAMETERS AND FUNCTIONS USAGEDESCRIPTION
setEventNameProperties@param {string} eventName

@param {callback} cb

setEventNameProperties(eventName, cb)

Example

import {setEventProperties} from 'zeo-collect'
...
setEventNameProperties("eventName", (res) => {})
This method is used to send an event to Zeotap with the provided event name. A callback can be added to revise response from the function.
setEventProperties@param {string} eventName

@param {jsonObject} eventProperties

@param {callback} cb

setEventProperties(eventName, eventProperties, cb)

Example

import {setEventProperties} from 'zeo-collect'
...
eventProperties = {prop1: value1, prop2: value2}

setEventProperties("eventName", eventProperties, (res) => {})
This method is used to send an event to Zeotap along with the specified event properties and name.
setInstantEventNameProperties@param {string} name

@param {callback} cb

setInstantEventNameProperties(name, cb)Example

import {setInstantEventNameProperties } from 'zeo-collect'
...
setInstantEventNameProperties("eventName", (res) => {})
This method immediately sends an event with the given event name, without waiting in the queue to be sent as a batch.
setInstantEventProperties@param {string} eventName

@param {jsonObject} eventProperties

@param {callback} cb

setInstantEventProperties(eventName, eventProperties, cb)Example

import {setInstantEventProperties } from 'zeo-collect'
...
eventProperties = {prop1: value1, prop2: value2}

setInstantEventProperties("eventName", eventProperties, (res) => {})
This method immediately sends an event with the given event name and event properties, without waiting in the queue to be sent as a batch.
setUserProperties@param {jsonObject} userProperties

@param {callback} cb

setUserProperties(userProperties, cb)Example

import {setUserProperties } from 'zeo-collect'...userProperties = {prop1: value1, prop2: value2}

setUserProperties(userProperties, (res) => {})
This method sends an event with the given user properties along with default user properties. You can use setUserProperties to override the existing user properties.
setPageProperties@param {jsonObject} userProperties

@param {callback} cb

setPageProperties(pageProperties, cb)Example

import {setPageProperties } from 'zeo-collect'...pageProperties = {prop1: value1, prop2: value2}

setPageProperties(pageProperties, (res) => {})
This method sends an event with the given page properties. Note that all the subsequent events will include a page node with these page properties. You can use setPageProperties to override the existing page properties.
setUserIdentities@param {json [string: string]} userIdentities``@param {callback} cb

setUserIdentities(userIdentities, cb)Example

import {setUserIdentities } from 'zeo-collect'...userIdentities = {prop1: value1, prop2: value2}

setUserIdentities(userIdentities, (res) => {})
This method sends an event with the provided user identities. Note that all the subsequent events will include a user node with these user identities.
unSetUserIdentitiesunSetUserIdentities()

Example

import {unSetUserIdentities } from 'zeo-collect'
...
unSetUserIdentities()
This method is used to remove user identities that are set using the setUserIdentities method.
pauseCollectionpauseCollection()Exampleimport {pauseCollection } from 'zeo-collect'
...
pauseCollection()
This method is used to temporarily suspend the package from collecting events for the user’s actions.
resumeCollectionresumeCollection()Exampleimport {resumeCollection } from 'zeo-collect'
...
resumeCollection()
This method restarts event collection in the package if it was previously paused using the pauseCollection() method.
setConsent@param {jsonObject} consentData

@param {callback} cb``setConsent(consentData, cb)

Example

import {setConsent } from 'zeo-collect'
...
setConsent(consentData, (res) => {})
This method sets consent in the non-TCF Consent Management Platform included in the package. It also allows passing brand consent to persist forthe user. Additionally, it supports an optional callback function.
listenToAskForConsent@param {Function} callback

listenToAskForConsent(callback)

Example

import {listenToAskForConsent} from 'zeo-collect'
...
listenToAskForConsent(callback)
This function includes a callback that is triggered when the package encounters a consent resolution issue. You can provide a UI callback function as an argument to gather user consent, which can then be set through the setConsent(consentData)function. Note that it is applicable only for custom consent.

Verify Connection

Upon successful integration, send some events through your app to verify the connection. Once the connection is established and tested, log in to the Zeotap CDP App and navigate to the particular Android or iOS source that you have created and view the data in the PREVIEW tab.

Track Page Views

After integrating the package, you can log the users’ page view events by calling setPageProperties({ prop1: value1, prop2: value2 }) and sending all page related information as key=value properties on the page load event. All further user events on the same page are then attached with these page properties.
FunctionParameter TypeDescription
setPagePropertiesObject with key as String and value as Any. {String: Any}This function allows you to specify properties unique to a particular page.
Below is an example showing how to capture user viewing a Product page:
Code
import { setPageProperties } from 'zeo-collect';  
// ...  
const pageProperties = { "name": "Product" }; 
setPageProperties(pageProperties);
Note:If the page properties are not defined, then by default, no page property is available on an event payload.

Track User Actions

After tracking the page views, you can start tracking the events. Use the setEventProperties method to track different user actions on the Application (for example, the selectVariant event with colour as a property) and properties relating to the event (for example, a ViewProduct event with productName, color as a property).
Note:If you need to track only event name, then you can use setEventNameProperties method.
FunctionTypeDescription
setEventNamePropertiesStringThis is the name of the event.
setEventPropertiesObject with key as String and value as Any {String: Any}This is the object containing any properties for a particular event.
The following are the two types of events that you can capture using react native:
  • System Events
  • Custom Events
System Events - System events refer to predefined actions that the system tracks based on specific user interactions. These events capture essential activities related to user consent and identities. These events ensure consistent tracking and tagging of key actions, which aids in debugging and understanding user behaviour. You can use these events to enrich the user profiles with the information captured. The following table lists the system events that are triggered in specific scenarios:
Note:This granular level of tracking has been enabled since May 14, 2024. Any system event tracked before this date is tagged with the common name SystemEnrichmentEvent which could have been triggered by any of the scenarios listed below.
Event Name (Tags)Scenarios
Set consentTriggers the first time a user lands on the app and sets consent
Update consentTriggers when a user changes their consent
Set identitiesTriggers when a user logs in
Update identitiesTriggers when a user changes already set identities
Custom Events - Custom events refer to user-defined actions specific to your application that are not covered by predefined system events. These events can be used to track additional behaviours, capture specific data points and provide deeper insights into user activities. The following table lists some examples of custom events:
Event Name (Tags)Scenarios
Add to cartTriggers when a user adds an item to their shopping cart
Remove from cartTriggers when a user removes an item from their shopping cart
Complete purchaseTriggers when a user completes a transaction
Below is an example showing how to track a product being viewed, which is triggered on the ViewProduct event:
Code
import {setEventProperties} from 'zeo-collect' 
... 
let eventProperties = { 
"productName": "test product", 
"color": "white", 
"price": "100" 
} 
setEventProperties("ViewProduct", eventProperties)
Below example shows the creation of the following payload in Android API call:
Code
{ 
"events": [ 
{ 
"eventUUID": "4b22525c-de33-4c5f-8934-e04e682e9f6e", 
"event": { 
"eventName": "ViewProduct", 
"productName": "test product", 
"color": "white", 
"prize": "100", 
"eventTimestamp": "2022-01-11 07:25:23 UTC" }, 
"user": { 
"App_version": "1.0", 
"adid": "93200ff8-9c05-4a27-9081-9a123543689b", 
"Device_ID": "51a03094e32facc3", 
"IP": "192.168.232.2", 
"Network_Type": "Wifi_Internet", 
"DeviceInfo": "Google : Android SDK built for x86 : 8.1.0", 
"user_zi": "a355b5e1-c5e3-4993-ba33-99c74555cb63", 
"App_name": "ZeotapApp", 
"Carrier": "Android" }, 
"version": "0.0.1" 
} 
] 
}
Below example shows the creation of the following payload in iOS API call:
Code
{ 
"events": [ 
{ "eventUUID": "4b22525c-de33-4c5f-8934-e04e682e9f6e", 
"event": { 
"eventName": "ViewProduct", 
"productName": "test product", 
"color": "white", 
"price": "100", 
"eventTimestamp": "2022-01-11 07:25:23 UTC" }, 
"user": { "app_name": "TestApp", 
"advertising_id": "8626081E-56FB-4EB8-968D-56BB6156BB26" 
"att_authorization_status": "authorized" 
"os_type": "iOS" 
"os_version": "15.5", 
"country": "GBR" 
"app_version": "1.0", 
"device_model_identifier": "iPhone13,2", 
"network_type": "wi-fi", 
"carrier": "Jio 4G", 
"zi": "3B2F4C6D-2455-4BFD-8A1C-04FB5FEE4017" 
}, 
"version": "1.0.0" 
} 
] 
}

Identify Default Users

The package creates an ID called zi for user identification. This ID is attached to all the event calls from the package, such as page views and user events. This ID is unique per the application. UserDefaults is utilised for storing these IDs with an encrypted key that is derived from the <write_key>. The zi ID is unique to each instance of the package that is write key based. The table below explains certain features available in the package regarding the zi ID.
FunctionDescription
getZIThis is the method to get the zi value.
resetZIThis is the method to reset the zi value for a user. You can.

Capture Users Properties

You can use the setUserProperties method to attach user information for a known user who is using the Application. The user information is as follows:
  • DB ID for the user (recommended)
  • Any additional information about the user that you want to identify as a user attribute
Call setUserProperties(properties) where properties is an object containing user identifiers and attributes that are sent as key=value properties to package events. Below is an example showing how to add user attributes of the user visiting the app:
Code
import {setUserProperties } from 'zeo-collect' 
... 
let userProperties = { 
"property": "value" } 
setUserProperties(userProperties);
If the user is unknown, then you can skip this. By default, we automatically assign pseudonymous-ids to keep track of users as they navigate around your Application.
Note:The records for the country and city columns are blacklistedfor ingestion because SPL uses the user’s IP address to find out the country and city automatically. For the complete list of blacklisted fields, click here.

Capture User Identities

The setUserIdentities method identifies the object that is set by the user and saved in the user storage. The following are the keys that are accepted in user Identities:
NameTypeDescription
emailStringThis is the email address of the user.
loginidStringThis is the login id of the user.
cellnoStringThis is the cell phone number of the user. Ensure that you provide the cell phone number in the following format [country_code][space][cell_number]. For example,49 1234567890. We recommend that you always send cell phone number in this format.
Do not include ‘+’ while sending the cell phone numbers.
cellno_ccStringThis is the cell phone number of the user with the country code.
We recommend that you do not provide cell phone numbers with country code.
Below is an example showing how to pass the user identities:
Code
import {setUserIdentities } from 'zeo-collect'  

let userIdentities = { 
"email": "test@gmail.com", 
"loginid": "testUser123", 
"cellno": "49 1234567890", \
"cellno_cc", "91-1234890987" 
}  
setUserIdentities(userIdentities);

Raw User Identities

While capturing user identities in the raw form, you may or may not want Zeotap to hash them. Refer to the table below to understand the scenarios, the package options that are involved and a sample to invoke the setUserIdentities method.
ScenarioPackage OptionssetUserIdentities
You send raw user identities, but do not want Zeotap to hash them.The following package options are involved in this scenario:
"are_identities_hashed": false,
"hash_identities": false
let userIdentities = {
"email": "test@gmail.com",
"cellno": "49 1234567890"
}
setUserIdentities(userIdentities);
You send raw user identities and want Zeotap to hash them.The following package options are involved in this scenario:
"are_identities_hashed": false,
"hash_identities": true
let userIdentities = {
"email": "test@gmail.com",
"cellno": "49 1234567890"
}
setUserIdentities(userIdentities);
Note:By default, if you want Zeotap to hash to user identities, we hash the raw identities to sha256, sha1 and md5.

Hashed User Identities

You may only send in user identities that are hashed using algorithms like SHA256, SHA1 and MD5. In this scenario, refer to the table below to understand the scenario, the package options that are involved and a sample for the setUserIdentities property.
ScenarioPackage OptionsDescription
You send hashed user identities onlyThe package option involved in this scenario is "are_identities_hashed": true,let userIdentities = {
"email_sha256_lowercase": "b0492275843c15593b
ba8a749c3379e3b5067aab173e91fcb37d840ca8b1738d",
"cellno_with_country_code_sha256":"91-1234890987"}
setUserIdentities(userIdentities);
While sending hashed user identities, send the userIdentit`ies object with following key names. Data type of all keys and values are string.
Key nameKey and Value TypeDescription
email_sha256_lowercaseStringThis is the user’s email address hashed to sha256 after converting it to lowercase
email_sha256_uppercaseStringThis is the user’s email address hashed to sha256 after converting it to uppercase
email_md5_lowercaseStringThis is the user’s email address hashed to md5 after converting it to lowercase
email_md5_uppercaseStringThis is the user’s email address hashed to md5 after converting it to uppercase
email_sha1_lowercaseStringThis is the user’s email address hashed to sha1 after converting it to lowercase
email_sha1_uppercaseStringThis is the user’s email address hashed to sha1 after converting it to uppercase
cellno_without_country_code_sha256“StringThis is the user’s cell phone number without the country code and hashed to sha256.
cellno_without_country_code_md5“StringThis is the user’s cell phone number without the country code and hashed to md5.
cellno_without_country_code_sha1StringThis is the user’s cell phone number without the country code and hashed to sha1.
cellno_with_country_code_sha256“StringThis is the user’s cell phone number with the country code and hashed to sha256.
cellno_with_country_code_md5“StringThis is the user’s cell phone number with the country code and hashed to md5.
cellno_with_country_code_sha1StringThis is the user’s cell phone number with the country code and hashed to sha1.
cellno_e164_sha256“StringThis is the user’s cell phone number in e164 format hashed to sha256.
cellno_e164_md5“StringThis is the user’s cell phone number in e164 format hashed to md5.
cellno_e164_sha1StringThis is the user’s cell phone number in e164 format hashed to sha1.
loginid_sha256_lowercaseStringThis is the user’s login ID that is logged. We hash the login ID to sha256 after converting to lowercase.
loginid_md5_lowercaseStringThis is the user’s login ID that is logged. We hash the login ID to md5 after converting to lowercase.
loginid_sha1_lowercaseStringThis is the user’s login ID that is logged. We hash the login ID to sha1 after converting to lowercase.
loginid_sha256_uppercaseStringThis is the user’s login ID that is logged. We hash the login ID to sha256 after converting to uppercase.
loginid_md5_uppercaseStringThis is the user’s login ID that is logged. We hash the login ID to md5 after converting to uppercase.
loginid_sha1\_uppercaseStringThis is the user’s login ID that is logged. We hash the login ID to sha1 after converting to uppercase.
Note:To know about the hashing guidelines for email and cell phone numbers, refer here.

Set Events With Callback Function

You can also set events with Callback function as shown below. Note that the data parameter is an object that contains status and message.
Code
import {setEventProperties} from 'zeo-collect' 
... 
let eventProperties = { 
"productName": "test product", 
"color": "white", 
"price": "100" 
} 
setEventProperties("ViewProduct", eventProperties, (res) => {
// Implementation of callback function
})
Note:For more information about the Callback function status codes and errors, refer here.

Log Out Communication

If you no longer wish to attach these identities to the events (for example, when the user logs out) you can communicate this by using unSetUserIdentities and then remove identities. Call the following method: unSetUserIdentities()

Send User Profile Information

If you have any other information you want to send about the user on the app, you can send the same using setUserProperties. This is sent to the API with the default user zi ID, along with any other identities set using setUserIdentities. Below is an example showing how to pass the user profile information:
Code
let userProperties = 
{ "profileInfo": "xyz" }  
setUserProperties(userProperties);
This example creates the following payload:
Code
{  "events": [  
{  "eventUUID": "4b22525c-de33-4c5f-8934-e04e682e9f6e",  
"event": {  
"eventName": "set_user_properties",  
"eventTimestamp": "2022-01-11 07:25:23 UTC"  },  
"user": {  "profileInfo": "xyz",  
"app_name": "TestApp",  
"advertising_id": "8626081E-56FB-4EB8-968D-56BB6156BB26",  
"att_authorization_status": "authorized",  
"os_type": "iOS",  
"os_version": "15.5",  
"country": "GBR",  
"app_version": "1.0",  
"device_model_identifier": "iPhone13,2",  
"network_type": "wi-fi",  
"carrier": "Jio 4G",  
"zi": "3B2F4C6D-2455-4BFD-8A1C-04FB5FEE4017",  
"email": {  
"sha256_uppercase":  "1646f5abd0f70d957a1023d3f590112c5414870a645f70e886190cb7bb21b7c8",  
"md5_uppercase": "e307f5ddc2a641dc63ace209e17b4f80",  
"sha256_lowercase":  "87924606b4131a8aceeeae8868531fbb9712aaa07a5d3a756b26ce0f5d6ca674",  
"md5_lowercase": "1aedb8d9dc4751e229a335e371db8058",  
"sha1_uppercase": "3bc0530dc30b220971f51e8d9366404459a41b3f",  
"sha1_lowercase": "ea97b75619f5cb2b9df9d184c4541aafe3b87484"  },  
"loginid": {  
"sha256_uppercase":  "ae92131ba35250a06293a5559c1ba6ac76dd3ddb9739296e98346b3e85e78082",  
"md5_uppercase": "b56863686f58f6c4db3fbf4ecec528d0",  
"sha256_lowercase":  "d79aeec77b3b6e6ec5f45ae5e040173380262e1ea51b38747195c3cf09a02f16",  
"md5_lowercase": "e4b4efd20ada72c6f7708b0c1cc78469",  
"sha1_uppercase": "53bdce88eeb1dcfb7fc5bed5e184bb731e0a1626",  
"sha1_lowercase": "7f58658e453b43196b35d75720b8c35fd2f85bba"  },  
"cellphone_number_withoutcode": {  
"sha1": "01b307acba4f54f55aafc33bb06bbbf6ca803e9a",  
"sha256":  "c775e7b757ede630cd0aa1113bd102661ab38829ca52a6422ab782862f268646",  
"md5": "e807f1fcf82d132f9bb018ca6738a19f"  },  
"cellphone_number_withcode": {  
"sha1": "8484de05645d4f91ac601302eb86243c92cb658c",  
"sha256":  "b0492275843c15593bba8a749c3379e3b5067aab173e91fcb37d840ca8b1738d",  
"md5": "39483edd3a189837aedd9916e4ff32fc"  },  
"cellphone_number_e164": {  
"sha1": "9bd6ad2d480f48e483d87fb7bf456c2ad0dc3744",  
"sha256":  "e8bd567e917e41a827e93d920c096d24306dd9378394540df7fd94a611e96439",  
"md5": "99e1e1b0616b4c007a81b7872ce76606"  
}  
},  
"version": "0.0.1"  
}  
]  
}
The consent that you provide is used for the following two primary purposes:
  • User identification
  • Tracking user data
The package has two different ways to determine user consent that enable the collection, documentation and management of your user’s privacy choices in order to ensure legal compliance. Zeotap stores the consent information in the customer profile against their unique Customer ID. For more information on how Zeotap stores and processes consent, you can refer to the Consent Management feature of Zeotap.

Default Opt-in

In this scenario, you directly provide consent to Zeotap by setting the opt_out flag to true or false. For all these three purposes, if the opt_out flag is set to true, then it indicates that you have not granted access to Zeotap. Here, package is not allowed to perform user identification or tracking user data. However, if the opt_out flag is set to false, then the package is allowed to perform all the above actions.
key nameTypeValueDescription
opt_outBooleanfalseThis is an explicit consent signal that you set. When enabled, the package can perform user identification and event capturing.
opt_outBooleantrueThis is an explicit consent signal that you set. When disabled, the package cant perform user identification and event capturing.

GDPR TCF CMP

If you already have a TCF 2.0 Consent Management Platform (CMP) implemented on your app, then the package automatically checks for the same. To do this, both the use_consent and check_for_cmp flags are set to true. The package also queries the TCF consent string to fetch the Publisher’s consent before recording the events. The below table describes the keys/parameters that need to be configured while using the GDPR consent module in package options.
key nameTypeValueDescription
use_consentBooleantrueIf this option is set to true, then the package waits to receive a consent signal and uses that consent to manage actions.
check_for_cmpBooleantrueIf this option is set to true, then we check for the presence of the TCF 2.0 variables in the UserDefaults. If the TCF 2.0 variables are present, then we query the CMP API and check for the publisher’s consent.If this option is set to false, then we use the set consent signal using the setConsent method.
check_zeotap_vendor_consentBooleantrue or falseIf this option is set to true, then the package checks for Zeotap Vendor consent, while resolving GDPR consent to send the data. If set to false, then the package ignores the Zeotap Vendor consent. By default, check_zeotap_vendor_consent is set to false.
purposes_for_tracking[number]default = [1, 3, 4]This option is used to pass a list of purpose IDs, based on which you can manage the consent for tracking.
To know more about the purposes for tracking and the associated IDs, refer to the “Appendix A: Purposes andFeatures Definitions” section of this topic.
purposes_for_identifying[number]default = [1, 9]This option is used to pass a list of purpose IDs, based on which you can manage the consent for identification.
To know more about the purposes for identification and the associated IDs, refer to the “Appendix A: Purposes andFeatures Definitions” section of this topic.
You may not want to explicitly give consent or even use the TCF API. Instead, they may want to have a custom consent flow. The following three points summarize this scenario:
  • The use_consent flag is set to true
  • The check_for_cmp option is set to false
  • The setConsent method is used to resolve the user consent
The user consent is then stored in UserDefaults and used as the user’s consent status for the subsequent event log until a new status is set using the same. The following are the keys that are accepted in user consent:
NameTypeDescription
trackbooleanIf this option is set to true, then you can track any user data.
identifybooleanIf this option is set to true, then it allows to identify you and a user.
In custom consent, you provide access to a specific consent signal based on their requirement. The consent is passed as a Dictionary object. Granular Consent has the following consent signals:
  • track – This consent signal is used to track and record user activities. Any consent cookie created to store consents can use this permission, as it precedes all other data collection.
  • identify – This consent signal is used for user matching and third-party enrichment(for example, zcookie and ID+ permissions).
In granular consent, you can provide access to one or more consent signals. For example, of all the consent signals you may provide access to Tracking but not for Identification. The consent is passed in the form of a Dictionary with the particular signal marked as true or false. Going by the above example, the Object is set to true for Tracking and false for Identification. Call the setConsent Method Call the setConsent method as mentioned below:
Code
let consentData = {"track": true,"identify": true} 
setConsent(consent: consentData); // to signal consent
let consentData = {"track": false,"identify": false}
setConsent(consent: consentData); // to signal opt out
The package waits for a consent call if it is unable to find the saved consent. To know when to ask for consent in case a consent signal is not available, add a callback listener as mentioned below:
Code
listenToAskForConsent 
(action: { _ in 
// trigger UI to appear 
});
Use the setConsent method to store brand-specific consent, such as zeotapVendorConsent or xyzVendorConsent, and ensure it persists across all events.

Example

JavaScript
let brandConsentData = {"zeotapVendorConsent": true, "xyzVendorConsent": false}
setConsent(brandConsentData);
This method works with all consent configuration settings to pass brand consent when consent is resolved.
Note:For consent types other than custom consent, the track and identify flags are ignored because the consent configuration differs.

Contextual Information

Zeotap records additional information relating to an event triggered or a page being loaded and then supplements details to the data point being captured. The following are the contextual information that Zeotap captured:
  • Device Id/iOS id
  • Telco carrier, Network type, OS Version
  • DeviceManufacturer
  • DeviceModel
  • DeviceVersion
  • ClientAppName and ClientAppVersion

Capture Advertising ID in iOS

The zeo-collect package automatically collects the Identifier for Advertisers (IDFA) from the user’s device, if the iOS version is 13 or lower. This is then passed in the event payload as advertising_id. However, in the case of iOS 14 or higher, the package does not collect the IDFA automatically due to Apple’s latest privacy guidelines. For more information about Apple’s User privacy and data use guidelines, refer here.

Collect the Identifier for Advertisers (IDFA)

You can include the Identifier for Advertisers (IDFA) in the event payload by using Apple’s App Tracking Transparency (ATT) framework. ATT enables displaying a pop-up to the user, seeking their permission to access the IDFA. Upon receiving a response from the user, the package appends att_authorization_status and advertising_id to the payload. Note that the advertising_id is passed along with the event payload only after att_authorization_status is authorised.
Note:For more information about the Apple’s App Tracking Transparency (ATT) framework, refer here.

Set Apple’s App Tracking Transparency (ATT) Status

You can set the Apple’s App Tracking Transparency (ATT) status either from the iOS module or the React Native package as mentioned below.

Set ATT Status from iOS Module

You can pass the ATT authorisation status from the iOS module in the following two ways:
Note:The options are invoked from the iOS module of your project within Swift/Objective-C files.
  • setAdvertisingIdByATTStatus - By passing att_authorization_status to this function, the package captures the IDFA from the device. Subsequently, transmits the identifier along with its status within the payload.
Code
import AppTrackingTransparency
import AdSupport
import ZeotapCollect

ATTrackingManager.requestTrackingAuthorization { status in
Collect.getInstance()?.setAdvertisingIdByATTStatus(status: status)
}
  • setATTStatusAndAdvertisingId - This function accepts the ATT authorisation status and IDFA string based on the permission granted. However, If the permission is denied, then you can pass the ATT authorisation status alone to the package.
Code
import AppTrackingTransparency
import AdSupport
import ZeotapCollect

ATTrackingManager.requestTrackingAuthorization { status in
switch status {
  case .authorized:
    Collect.getInstance()?.setATTStatusAndAdvertisingId(
    status: status,
    advertisingId:
    ASIdentifierManager.shared().advertisingIdentifier.uuidString
    )
  case .denied:
    Collect.getInstance()?.setATTStatusAndAdvertisingId(
    status: status
    )
  case .notDetermined:
    Collect.getInstance()?.setATTStatusAndAdvertisingId(
    status: status
    ) 
  case .restricted:
    Collect.getInstance()?.setATTStatusAndAdvertisingId(
    status: status
    )
  @unknown default:
    print("Unknown")
  }
}

Set ATT Status from React Native Module

You can pass the ATT authorisation status from the React Native module in the following two ways:
  • setAdvertisingIdByATTStatus – By passing ATTStatus to this function, the package retrieves the IDFA from the device and includes the identifier along with its status in the payload.
MethodParameterDescription
setAdvertisingIdByATTStatus@param {string} ATTStatus
setAdvertisingIdByATTStatus(ATTStatus)
Use this function to set ATT status from react native module. The parameter in the function is of data type string and the following are the valid entries:
  • authorised

  • denied

  • restricted

  • not-determined

Code
import 'setAdvertisingIdByATTStatus' from 'zeo-collect'

// retrieve ATT status 
setAdvertisingIdByATTStatus(ATTStatus)
  • setATTStatusAndAdvertisingId - This function requires the ATT authorisation status (in String format) and the IDFA string based on the permission. However, If the permission is denied, then you can pass the ATT authorisation status alone to the package.
MethodParameterDescription
setATTStatusAndAdvertisingId@param {string} ATTStatus
@param {string} advertisingId
setATTStatusAndAdvertisingId(ATTStatus, advertisingId)
Use this function to set ATT status and advertisingId from React Native module.The following are the valid entries for ATTStatus:
  • authorised

  • denied

  • restricted

  • not-determined

Code
import 'setATTStatusAndAdvertisingId' from 'zeo-collect'

// retrieve ATT status 
setAdvertisingIdByATTStatus(ATTStatus, advertisingId)
Last modified on February 26, 2026