Skip to content

Your first integration

A screen-by-screen plan for a first Segmentify iOS SDK integration, with a checklist for going live.

View as Markdown llms.txt

This page is the order to build things in. Each step links to the page with the code.

Your app tells Segmentify what the user does by calling one SDK method per action. Segmentify answers some of those calls with recommendations: lists of products to show on that screen, as set up in your Segmentify panel. So the same calls both collect data and fetch content.

Methods that can return recommendations take a closure. Methods that only record something (basket changes, clicks, user events) return nothing.

  1. Install the SDK.
  2. Configure it at app start with your API key, data center URL and domain.
  3. Turn on logs while you develop.

Step 2: Send a page view from every screen

Section titled “Step 2: Send a page view from every screen”

Call sendPageView when a screen opens, with the screen’s category. This is the minimum integration: it identifies visitors and lets campaigns target screens.

let page = PageModel()
page.category = "Home Page"
page.lang = "EN"
page.currency = "EUR"
SegmentifyManager.sharedManager().sendPageView(segmentifyObject: page) { recommendations in
// recommendations holds the widgets to show on this screen
}

See Page View for the category names.

When Call Page
A product screen opens sendProductView (and sendPageView with Product Page) Product View
A product is added to or removed from the basket sendAddOrRemoveBasket Basket and Checkout
The basket screen opens sendViewBasket Basket and Checkout
An order is completed sendPurchase Basket and Checkout

These four are what recommendations and revenue reports are built on. Get them right before adding anything else.

Render the recommendations returned to your callbacks, and report when a widget is shown and when a product in it is tapped. See Recommendations.

Feature Page
Sign-up, sign-in, profile and consent User Events
Wishlist Wishlist
Search Search
Banners Interactions and Banners
Your own triggers Custom Event
Push notifications Push Notifications
  • testMode is removed, or false, on every event.
  • lang and currency are set on every event and match your account.
  • sendProductView sends the real price, stock status, product URL and image.
  • sendPurchase is called once per order, with orderNo.
  • Product IDs are the same ones as in your product catalogue and on your website.
  • Logging is off in release builds.

If an event does not arrive, see Troubleshooting.