Using the Core Module - iOS

This section serves a quick guide for integrating the Infinity module with your iOS mobile applications.

iOS version compatibility

iOS Version Notes
1 iOS 16
2 iOS 15
3 iOS 14
4 iOS 13
5 iOS 12

Getting Started

The following steps help you integrate the Core module in your mobile application:

  1. Download the Core module
  2. Import the Core module into your mobile application project
  3. Configure and initialize the module

Downloading the Core module

Download the Core module from here.

Importing the Core module

Once the Core module is downloaded it must be into the mobile app project. For a step-by-step guide to importing the module into the project, please check here.

After the Core module is imported into your iOS project, the below steps must be completed to begin using the module.

  1. Configuring the mandatory settings in the Core module
  2. Initializing the Core module

Configuring the settings in the Core module

The Core module has been designed to work independently with all the product modules. All features of the Core module can be leveraged by any of the product modules except for event data transmission to the server.

Enable logging settings

The Core module provides a logging framework that allows developers to easily create logs for testing and debugging your mobile application.

When logging is enabled, the Core module generates log statements for the executed code. These logs can be used to analyse the application flow when you run into issues with the execution. The logs are categorized into different buckets.

Below are the different log levels used in the SDK

Level Log Level Description
1 None Disables logging of error messages
2 Error Logs all error messages
3 Warn Logs all warning messages and error messages
4 Info Logs all information, warning messages, and error messages
5 Debug This is a default log level. It logs all debug, information, warning messages, and error messages
6 Verbose Logs all messages with a detailed description of each message for debugging, information, warning messages, and error messages

The ORALogger class provides the necessary methods to enable or disable the logs.

The setLogLevel method is used to set the log level. When the log level is set, it will show the log messages for that level as well as the logs for all the levels lower in the list. For example, if you set the log level to Info, it will collect the logs for Info, Warn, and Error levels. The default log level is set as Debug. If you want to disable all the log messages, set the log level as None.

Swift 5.1
ORALogger.setLogLevel(ORALogLevel.Debug)
		
Objective C
[ORALogger setLogLevel:Debug];
		

The Core module is now configured and now we can start configuring the product modules.

Behavior data tracking

Endpoint configuration for Infinity module in the Core module

The Infinity module is currently dependent on the Core module to transfer the behavior data to the server. To enable the event data transfer to the server, the endpoint configuration needs to be added to the Core module. The configuration can be done in the following ways:

Using the oracle.json file

To enable behavior data tracking and transfer, the following settings must first be configured in the Core module. These settings must be added to the oracle.json file.

Configuration Parameter Description
1 ora_dc_end_point_config Endpoint configure as object
2 ora_dc_collection_url An infinity data collection base URL
3 ora_dc_account_guid An account GUID identifies your account. All your tags will use the same account GUID so that all data collected for your account is stored together
4 ora_dc_retry_count Retry count in case of network or server failures. The minimum allowed value is 1, maximum is 15 and the default value is 3.

After adding the above, your oracle.json will look like the following:

{
				"config_version": "1.0",
				"ORACORE": {
				"ora_dc_end_point_config": [
				{
				"ora_dc_collection_url": "https://dc.oracleinfinity.io/v3/",
				"ora_dc_account_guid": "your_account_guid",
				"ora_dc_retry_count": "2"
				}
				],
				"ora_dc_send_interval_millis": "10000"
				}
				}
		

Replace the "your_account_guid" with the id from your account. The "your_account_guid" could be found in the Infinity portal in your profile drop-down as highlighted in amber below.

Once the configuration is set, place the oracle.json file in the main folder of your mobile application project. This configuration will help to send data to the server. Now load these configurations from the code. This can be done in application:didFinishLaunchingWithOptions method of AppDelegate.

Swift 5.1
let coreContainer = ORACoreDataContainer()
				coreContainer.loadFromConfigFile()
		
Objective C
ORACoreDataContainer *coreContainer = [[ORACoreDataContainer alloc] init];
				[coreContainer loadFromConfigFile];
		

Note: During the app upgrade, if you would like to modify any of the configurations in the oracle.json, then please make sure to increase config_version value. Otherwise, SDK can’t load the updated configurations. If you are using an older version of the Core module(less-than v1.1.0) and upgraded to the newer version and want to use oracle.json file for loading config, you need to put config_version as higher than the version mentioned in loadConfig:versionNumber: method. When you want to update any configuration value, the config_version key to be incremented. Otherwise, SDK can’t load the updated configurations.

Advanced configuration You can control some optional parameters in the oracle.json like configuration versioning, set multiple endpoints to transfer the behavior data, etc.

Common Actions

This section guides the developers on capturing and triggering events and pausing/resuming event capture.

The Core module has convenience methods that help to trigger events to capture behavior data. A sample snippet of the triggerEvent method to capture behavior data given here for reference.

Swift 5.1
// Once we've set up our basic information, pass it to the data collector
				let event = ORACoreEventBuilder.createBaseEvent(withCustomParams: [
				ORA_DCSURI: EVENT_PATH_BUTTON
				])
				ORACoreDataCollector.shared().triggerEvent(event)
		
Objective C
// Once we've set up our basic information, pass it to the data collector
				NSDictionary *event = [ORACoreEventBuilder createBaseEventWithCustomParams:@{ORA_DCSURI: EVENT_PATH_BUTTON}];
				[[ORACoreDataCollector sharedCollector] triggerEvent:event];
		

The triggerEvent method creates and stores an event in the local database on the mobile. Based on the configuration value for ORAConfigSendIntervalMilliseconds parameter, core SDK fetches the events from the database and sends them to the data collection servers. This process takes a couple of seconds(based on the config) to reach event info to the server.

Real-time event tracking

The Core module can be used to capture events and transmit them in real time. The triggerEventImmediately method can be used to transmit the event immediately after capturing it. If connectivity is not available for transmission of a real-time event, we can use the configuration ORAConfigImmediateEventStoringEnabled to save the event data into the database and transferring it immediately when connectivity is available.

Swift 5.1
// Once we've set up our basic information, pass it to the data collector
				let event = ORACoreEventBuilder.createBaseEvent(withCustomParams: [
				ORA_DCSURI: EVENT_PATH_BUTTON
				])
				ORACoreDataCollector.shared(). triggerEventImmediately(event)
		
Objective C
// Once we've set up our basic information, pass it to the data collector
				NSDictionary *event = [ORACoreEventBuilder createBaseEventWithCustomParams:@{ORA_DCSURI: EVENT_PATH_BUTTON}];
				[[ORACoreDataCollector sharedCollector] triggerEventImmediately:event];
		

There are a wide variety of events you can trigger, all of which are documented in ORACoreDataCollector and the Manual Events Guide.

Tracking events automatically

The Core module can be configured to capture certain types of events automatically. These types of events include mobile application life-cycle events such as app start events, app background events, and so on. The arc of activity from the time an app is launched and enters into a device's memory to when it is exited and released from memory is referred to as the app's lifecycle. The events in the app's lifecycle can be captured automatically by enabling configuration in the Core module. Some sample parameters for tracking the events automatically are as follows:

  • ORAConfigViewControllerAutoEnabled
  • ORAConfigForegroundAutoEnabled
  • ORAConfigAppStartAutoEnabled
  • ORAConfigErrorAutoEnabled
  • ORAConfigSendScreenViewWithActivityViewEnabled

Setting these config values as true will enable automatic event triggering. See App life cycle doc for more details about automatic events.

Now the Core module is ready for starting to track events in the mobile application.

Learn more

Oracle Marketing Core Module

Using the Core Module - Android