expo-infonline-library v0.1.0
Expo INFOnline Library
A React Native wrapper for native INFOnline SDKs, providing seamless integration with the INFOnline(pseudonym measurements) analytics and tracking functionality in your Expo/React Native applications.
Note: Currently, this library only supports iOS. Android support is planned for a future release.
Requirements
- iOS: minSdkVersion 15.1
- Android: Planned for future release
- Native iOS INFOnline library (v.2.7.0 now embedded)
Features
- 📈 Parallel operation support for SZM and OEWA measurement sessions
- 📊 Session configuration and management
- 📱 View event tracking
- 🔍 Debug level control and logging
- 📝 Manual processing of TCF consent
Installation
In Managed Expo Projects
npx expo install expo-infonline-libraryUsage
Initialize Session
import ExpoInfonlineLibrary, {
IOLSessionType,
IOLPrivacyType,
} from "expo-infonline-library";
// Configure and start session
await ExpoInfonlineLibrary.startIOMpSession({
sessionType: IOLSessionType.SZM,
type: IOLPrivacyType.ACK,
offerIdentifier: "your-offer-id",
});Track View Events
import { IOLViewEventType, IOLSessionType } from "expo-infonline-library";
await ExpoInfonlineLibrary.logViewEvent({
sessionType: IOLSessionType.SZM,
type: IOLViewEventType.APPEARED,
category: "your-category",
comment: "your-optional-comment",
});Set Custom Consent
await ExpoInfonlineLibrary.setCustomConsent({
sessionType: IOLSessionType.SZM,
consent: "your-consent-string",
});Send Logged Events
await ExpoInfonlineLibrary.sendLoggedEvents(IOLSessionType.SZM);Set Debug Level (iOS)
import { IOLDebugLevel } from "expo-infonline-library";
await ExpoInfonlineLibrary.setDebugLogLevel(IOLDebugLevel.TRACE);Get Recent Logs
const logs = await ExpoInfonlineLibrary.mostRecentLogs(50); // Get last 50 logsCleanup
await ExpoInfonlineLibrary.terminateSession(IOLSessionType.SZM);API Reference
Session Management
startIOMpSession(payload: StartIOMpSessionPayload): Initializes the INFOnline sessionpayload.sessionType: Type of session (SZMorOEWA)payload.type: Privacy type (ACK,LIN, orPIO)payload.offerIdentifier: Identifier for the offerpayload.hybridIdentifier: Optional hybrid identifierpayload.customerData: Optional customer data
terminateSession(sessionType: IOLSessionType): Terminates the specified sessionsendLoggedEvents(sessionType: IOLSessionType): Sends logged events for the specified session
Event Logging
logViewEvent(payload: LogViewEventPayload): Logs view-related eventspayload.sessionType: Type of sessionpayload.type: One ofAPPEARED,REFRESHED, orDISAPPEAREDpayload.category: Category of the viewpayload.comment: Optional comment
Manual processing of TCF Consent
setCustomConsent(payload: SetCustomConsentPayload): Processes TCF consent string (IO notation)payload.sessionType: Type of sessionpayload.consent: Consent string
Debug & Logging
setDebugLogLevel(level: IOLDebugLevel): Sets debug logging level (iOS only)- Levels:
OFF,ERROR,WARNING,INFO,TRACE
- Levels:
mostRecentLogs(limit: number): Retrieves recent logs with specified limit
Types
enum IOLSessionType {
SZM = "szm",
OEWA = "oewa",
}
enum IOLPrivacyType {
ACK = "ack",
LIN = "lin",
PIO = "pio",
}
enum IOLViewEventType {
APPEARED = "appeared",
REFRESHED = "refreshed",
DISAPPEARED = "disappeared",
}
enum IOLDebugLevel {
OFF = "off",
ERROR = "error",
WARNING = "warning",
INFO = "info",
TRACE = "trace",
}
interface StartIOMpSessionPayload {
sessionType: IOLSessionType;
type: IOLPrivacyType;
offerIdentifier: string;
hybridIdentifier?: string;
customerData?: string;
}
interface LogViewEventPayload {
sessionType: IOLSessionType;
type: IOLViewEventType;
category: string;
comment?: string;
}
interface SetCustomConsentPayload {
sessionType: IOLSessionType;
consent: string;
}Example
Check out the example directory for a complete working demo of all features.
Documentation References
For more detailed information about the native SDKs, refer to the official documentation:
Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
License
This project is licensed under the MIT License - see the LICENSE file for details.
1 year ago