To set up Bloomreach pixels in your native iOS application, follow the steps below:

## 1. Add the SDK dependency package

The first step is to add the dependency package that contains the Bloomreach pixels for the iOS client library. To add the dependency, follow these steps:

  1. Click on “Add Packages” from the File menu of Xcode.


  1. Paste the framework's GitHub URL in the search box: <>

  1. Click on `discovery-ios-sdk`, select the `main` branch, and add the package to the appropriate project.

## 2. Initialization

To initialize the Discovery Pixel SDK in your app, first import the `discovery_ios_sdk` module in your **UIApplicationDelegate**:

Then initialize the Discovery SDK in your **app delegate's `application(_:didFinishLaunchingWithOptions:)` method** as shown:

If you are using **SwiftUI**, use the `UIApplicationDelegateAdaptor` property wrapper to tell SwiftUI it should use your AppDelegate class for the application delegate.

_Make sure to replace all the placeholder values for the parameter values in the snippet above._ <br> Here is a reference of all the different parameters you can set based on your requirements:

accountIdYour Account ID provided by Bloomreach
uuidA 13 Digit random number. Eg: 2342698118212
visitorTypeenum type for new or returning visitors
baseUrlBase URL of your site, provided by Bloomreach
domainKey (Optional)The Bloomreach-provided ID of the domain receiving the request
userId (Optional)Unique ID used to track the visitor. This parameter is only required if you track visitors via a universal customer ID
testData (Optional)Enter a Boolean value. Set test_data to False in the pixel for your prod release app
currency (Optional)Regional currency or currency used in the app
pixelUrlByRegionURL for Pixel server based on region. Defaults to the _NA_ region
customerTierTier that the visitor belongs to. eg: Premium, Gold. For use with Relevance by Segment
customerCountryCountry that the visitor belongs to or is accessing the site from. For use with Relevance by Segment
customerGeoGeography or Region that the visitor belongs to. For use with Relevance by Segment
customerProfileProfile of the visitor. For use with Relevance by Segment
viewId (Optional)This parameter is only required if you are integrating on a site with multiple site versions with unique product catalog characteristics. Otherwise, viewId should not be declared in the pixel as this might cause issues with analytics. During your technical kickoff call, the Bloomreach integrations team will inform you whether viewId will be required for your pixel integration or not. The value must be consistent with the view_id value passed in the feed and API calls.

The value of any of the above parameters can be modified later in the code, even after initialization. It can be done by using the following line:

`PixelTracker.shared.brPixel.<FIELD_NAME> = <VALUE>`

## 3. Triggering Pixels

Refer to the following guides to Trigger specific pixels in your Android Application:

<ul> <li><h3><a href="doc:triggering-page-view-pixels-ios">Page View Pixels</a></h3></li> <li><h3><a href="doc:triggering-event-pixels-ios">Event Pixels</a></h3></li> <li><h3><a href="doc:triggering-widget-pixels-ios">Widget Pixels</a></h3></li>


## 4. Pixel validation

You can test the integration of the Pixel SDK using the Pixel validator built inside the SDK. No additional integration is needed. The Pixel validator only works in debug mode. The response from Pixel validation will be printed in Logs of xCode, as below: