### Install Example App Dependencies Source: https://documentation.bloomreach.com/engagement/docs/react-native-sdk-example-app Run yarn to resolve and install dependencies for the example app. ```shell yarn ``` -------------------------------- ### Install CocoaPods Dependencies Source: https://documentation.bloomreach.com/engagement/docs/ios-sdk-example-app Run the CocoaPods command to install the necessary dependencies for the example app. ```shell pod install ``` -------------------------------- ### Install iOS Dependencies with CocoaPods Source: https://documentation.bloomreach.com/engagement/docs/flutter-sdk-example-app Navigate to the 'ios' directory and run 'pod install' to install all necessary dependencies for the iOS version of the example app. ```shell cd ios pod install cd .. ``` -------------------------------- ### Navigate to Example App Directory Source: https://documentation.bloomreach.com/engagement/docs/react-native-sdk-example-app Enter the 'example' directory which contains the example application. ```shell cd example ``` -------------------------------- ### Navigate to the Example App Directory Source: https://documentation.bloomreach.com/engagement/docs/flutter-sdk-example-app Change the current directory to the 'example' folder within the cloned SDK repository to access the example application. ```shell cd exponea-flutter-sdk/example ``` -------------------------------- ### Run the Example App on iOS Source: https://documentation.bloomreach.com/engagement/docs/react-native-sdk-example-app Execute this command to build and run the example app on an iOS simulator or device. ```shell react-native run-ios ``` -------------------------------- ### Configure SDK with Complex Project Mapping and Advanced Auth Source: https://documentation.bloomreach.com/engagement/docs/ios-sdk-configuration An example demonstrating a complex SDK configuration. It includes advanced settings like project mapping for multiple projects, custom base URLs, advanced authorization, detailed push notification tracking, session timeout, default properties, and specific flushing setup. ```swift Exponea.shared.configure( Exponea.ProjectSettings( projectToken: "YOUR PROJECT TOKEN", authorization: .token("YOUR ACCESS TOKEN"), baseUrl: "YOUR URL", projectMapping: [ .payment: [ ExponeaProject( baseUrl: "YOUR URL", projectToken: "YOUR OTHER PROJECT TOKEN", authorization: .token("YOUR OTHER ACCESS TOKEN") ) ] ] ), pushNotificationTracking: .enabled( appGroup: "YOUR APP GROUP", delegate: self, requirePushAuthorization: false, tokenTrackFrequency: .onTokenChange ), automaticSessionTracking: .enabled(timeout: 123), defaultProperties: ["prop-1": "value-1", "prop-2": 123], flushingSetup: Exponea.FlushingSetup(mode: .periodic(100), maxRetries: 5), advancedAuthEnabled: true, applicationID: "com.yourApplication.org" ) ``` -------------------------------- ### apple-app-site-association File Example Source: https://documentation.bloomreach.com/engagement/docs/ios-sdk-universal-links Example structure for the apple-app-site-association file on your website, specifying app identifiers and paths for universal links. ```json { "applinks": { "apps": [], "details": [ { "appID": "ABCDE12345.com.example.ExampleApp", "paths": [ "/engagement/*", "/*" ] } ] } } ``` -------------------------------- ### Get Consent Categories (Ruby) Source: https://documentation.bloomreach.com/engagement/reference/get-consent-categories-2 Example Ruby code to get consent categories. This snippet uses the 'httparty' gem for HTTP requests. Replace the placeholder values for your project token and API token. ```ruby require 'httparty' project_token = '12345678-1234-1234-1234-123456789abc' api_token = '' url = "https://api.exponea.com/data/v2/projects/#{project_token}/consent/categories" headers = { 'accept' => 'application/json', 'authorization' => "Token #{api_token}", 'content-type' => 'application/json' } response = HTTParty.get(url, headers: headers) if response.code == 200 puts response.parsed_response else puts "Error fetching consent categories: #{response.code} - #{response.body}" end ``` -------------------------------- ### Clone the SDK Repository Source: https://documentation.bloomreach.com/engagement/docs/react-native-sdk-example-app Clone the Exponea React Native SDK repository from GitHub to get started. ```shell git clone https://github.com/exponea/exponea-react-native-sdk.git ``` -------------------------------- ### JavaScript SDK Initialization Example Source: https://documentation.bloomreach.com/engagement/docs/javascript-sdk-configuration Basic example of initializing the JavaScript SDK with essential configuration options like target, token, and customer. This snippet demonstrates how to pass configuration directly into the integration snippet. ```javascript !function(e,n,t,i,r,a,c){function // ... the rest of the snippet ... target: "https://api.exponea.com", token: "323d7a16-ba47-12c9-8c2d-0a770a310d68", customer: "john.smith@exponea.com", ping: { enabled: true } // other configuration options go here }); ``` -------------------------------- ### Project Plist Configuration Example Source: https://documentation.bloomreach.com/engagement/docs/ios-sdk-configuration Example of a .plist file for project-based SDK configuration. It includes essential keys like projectToken, sessionTimeout, applicationID, and projectMapping for different event types. ```xml projectToken testToken sessionTimeout 20 applicationID com.yourApplication.org projectMapping INSTALL projectToken testToken1 authorization Token authToken1 TRACK_EVENT projectToken testToken2 authorization Token authToken2 projectToken testToken3 authorization PAYMENT baseUrl https://mock-base-url.com projectToken testToken4 authorization Token authToken4 autoSessionTracking ``` -------------------------------- ### Get Single Message Response (SMS) Source: https://documentation.bloomreach.com/engagement/reference/list-messages Example response for retrieving a single SMS message. Includes the message text. ```json { "success": true, "data": { "project_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "customer_id": "60b8d295f1a2c3001f9e4a12", "message_id": "65a1b2c3d4e5f60011223355", "channel": "sms", "sender": "+1234567890", "recipient": "+0987654321", "subject": null, "sent_timestamp": 1705000000.0, "campaign_name": "SMS Promo", "campaign_id": "64f1a2b3c4d5e60011223355", "action_id": 2, "action_name": "Promo SMS", "message": "Hi! Check out our latest offers." } } ``` -------------------------------- ### Clone the MAUI SDK Repository Source: https://documentation.bloomreach.com/engagement/docs/maui-sdk-example-app Clone the bloomreach-maui-sdk repository from GitHub to get the example app and SDK source code. ```shell git clone https://github.com/exponea/bloomreach-maui-sdk.git ``` -------------------------------- ### Run the Example App on Android (GMS) Source: https://documentation.bloomreach.com/engagement/docs/react-native-sdk-example-app Connect an Android device and run this command to build and launch the example app using Google Mobile Services. ```shell react-native run-android --mode=GmsDebug ``` -------------------------------- ### Get Integration Snippet Version Source: https://documentation.bloomreach.com/engagement/docs/integration Use `exponea.snippetVersion` to determine the version of the integration snippet implemented on your website. This helps in verifying the correct setup. ```javascript console.log(exponea.snippetVersion); ``` -------------------------------- ### Example exponea_configuration.json Source: https://documentation.bloomreach.com/engagement/docs/android-sdk-setup A sample JSON file for configuring the Exponea SDK, including project token, authorization, and base URL. This file should be placed in the 'assets' folder. ```json { "projectToken": "YOUR_PROJECT_TOKEN", "authorization": "Token YOUR_API_KEY", "baseURL": "https://api.exponea.com" } ``` -------------------------------- ### Fetch Customer Properties with Timestamps Source: https://documentation.bloomreach.com/engagement/docs/customer-properties-synchronization Example of fetching customer properties including last update timestamps. Use ?include_timestamps=1 in your GET request. ```json { “properties”: { “first_name”: {“value”: “Marian”, “last_update”: 1570001049}, “last_name”: {“value”: “Galik”, “last_update”: -1} } } ``` -------------------------------- ### Get Single Message Response (Email) Source: https://documentation.bloomreach.com/engagement/reference/list-messages Example response for retrieving a single email message. Includes full email content and attachment details. ```json { "success": true, "data": { "project_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "customer_id": "60b8d295f1a2c3001f9e4a12", "message_id": "65a1b2c3d4e5f60011223344", "channel": "email", "sender": "noreply@company.com", "recipient": "user@example.com", "subject": "Welcome to our platform", "sent_timestamp": 1705000000.0, "campaign_name": "Onboarding", "campaign_id": "64f1a2b3c4d5e60011223344", "action_id": 1, "action_name": "Welcome email", "sender_name": "Company", "preheader": "Get started with your new account", "email": "

Welcome!

", "attachments": [ { "filename": "guide.pdf", "size": 102400, "content_type": "application/pdf" } ] } } ``` -------------------------------- ### Create Custom Sub-Category (Text Attribute) Source: https://documentation.bloomreach.com/engagement/docs/consent-page Example of creating a custom sub-category using a text input for a customer attribute. The 'name' attribute must start with 'property_text'. ```html ``` -------------------------------- ### Clean Build Cache and Install Dependencies Source: https://documentation.bloomreach.com/engagement/docs/react-native-sdk-example-app Execute these commands to clean the cache, install project dependencies, build the SDK, and remove node_modules. ```shell ./cleanCache.sh yarn yarn run build rm -rdf node_modules ``` -------------------------------- ### Get Consent Categories (Python) Source: https://documentation.bloomreach.com/engagement/reference/get-consent-categories-2 Example Python code to retrieve consent categories using the 'requests' library. Remember to substitute your project token and API token. ```python import requests project_token = '12345678-1234-1234-1234-123456789abc' api_token = '' url = f"https://api.exponea.com/data/v2/projects/{project_token}/consent/categories" headers = { 'accept': 'application/json', 'authorization': f'Token {api_token}', 'content-type': 'application/json' } response = requests.get(url, headers=headers) if response.status_code == 200: print(response.json()) else: print(f"Error fetching consent categories: {response.status_code} - {response.text}") ``` -------------------------------- ### cURL Request Example Source: https://documentation.bloomreach.com/engagement/reference/read-import This snippet shows a cURL command to make a GET request to the Bloomreach Engagement API. It includes the URL, request method, and necessary headers for authorization. ```Shell curl --request GET \ --url https://api.exponea.com/imports/v1/project_token/import_id \ --header 'accept: application/json' \ --header 'authorization: Basic 4oCi4oCi4oCi4oCiOuKAouKAouKAouKAog==' ``` -------------------------------- ### Initialize SDK with Project Configuration Source: https://documentation.bloomreach.com/engagement/docs/android-sdk-setup Initialize the Exponea SDK using project-specific configuration, including base URL, project token, and authorization. ```kotlin val configuration = ExponeaConfiguration() configuration.integrationConfig = ProjectConfig( baseUrl = "https://api.exponea.com", projectToken = "YOUR_PROJECT_TOKEN", authorization = "Token YOUR_API_KEY" ) Exponea.init(this, configuration) ``` -------------------------------- ### Initialize SDK with Token Authorization Source: https://documentation.bloomreach.com/engagement/docs/android-sdk-authorization Demonstrates how to initialize the Exponea SDK using ProjectConfig with token authorization. Ensure you replace 'YOUR_PROJECT_TOKEN' and 'YOUR_API_KEY' with your actual credentials. ```kotlin class App : Application() { override fun onCreate() { super.onCreate() val configuration = ExponeaConfiguration() configuration.integrationConfig = ProjectConfig( baseUrl = "https://api.exponea.com", projectToken = "YOUR_PROJECT_TOKEN", authorization = "Token YOUR_API_KEY" ) Exponea.init(App.instance, configuration) } } ``` -------------------------------- ### Get Consent Categories (cURL) Source: https://documentation.bloomreach.com/engagement/reference/get-consent-categories-2 Example cURL request to retrieve all consent categories for a given project. Ensure you replace placeholders with your actual project token and API token. ```shell curl --request GET \ --url https://api.exponea.com/data/v2/projects/12345678-1234-1234-1234-123456789abc/consent/categories \ --header 'accept: application/json' \ --header 'authorization: Token ' \ --header 'content-type: application/json' ``` -------------------------------- ### Parameter Reference Examples Source: https://documentation.bloomreach.com/engagement/docs/new-html-blocks Demonstrates how to reference parameters in Jinja templates. Multi-word parameter names require bracket notation. ```text {{ params.parameterName }} or {{ params["parameter name"] }} {% set otherVariable = params.parameterName %} {% if param.paramName = "something" %} ... {% endif %} ``` -------------------------------- ### Create Custom Sub-Category (Boolean Attribute) Source: https://documentation.bloomreach.com/engagement/docs/consent-page Example of creating a custom sub-category using a boolean customer attribute. Ensure the 'name' attribute starts with 'property' and include a hidden input for unchecked states. ```html ``` -------------------------------- ### Get Consent Categories (Node.js) Source: https://documentation.bloomreach.com/engagement/reference/get-consent-categories-2 Example Node.js code to fetch consent categories. This snippet uses the 'axios' library for making HTTP requests. Replace placeholders with your project token and API token. ```javascript const axios = require('axios'); const projectToken = '12345678-1234-1234-1234-123456789abc'; const apiToken = ''; axios.get(`https://api.exponea.com/data/v2/projects/${projectToken}/consent/categories`, { headers: { 'accept': 'application/json', 'authorization': `Token ${apiToken}`, 'content-type': 'application/json' } }) .then(response => { console.log(response.data); }) .catch(error => { console.error('Error fetching consent categories:', error); }); ``` -------------------------------- ### Configure and Fetch Recommendations Source: https://documentation.bloomreach.com/engagement/docs/flutter-sdk-fetch-data Use RecommendationOptions to configure recommendation fetching. This example sets a model ID and enables random filling, then fetches recommendations and prints their item IDs or logs any errors. ```dart final options = RecommendationOptions( id: 'recommendation_id', fillWithRandom: true, ); _plugin.fetchRecommendations(options) .then((list) => list.forEach((recommendation) => print(recommendation.itemId))) .catchError((error) => print('Error: $error')); ``` -------------------------------- ### Get Consent Categories (PHP) Source: https://documentation.bloomreach.com/engagement/reference/get-consent-categories-2 Example PHP code to retrieve consent categories. This snippet uses cURL functions for making the HTTP request. Ensure you replace the project token and API token placeholders. ```php '; $url = "https://api.exponea.com/data/v2/projects/{$projectToken}/consent/categories"; $headers = [ 'accept: application/json', 'authorization: Token ' . $apiToken, 'content-type: application/json' ]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); if (curl_errno($ch)) { echo 'Error:' . curl_error($ch); } else { echo $response; } curl_close($ch); ?> ```