Personyze Wiki Personyze Wiki docs
English
Open Personyze
Docs/ Mobile Apps/ Targeting & Personalization for Mobile Apps
Mobile Apps

Targeting & Personalization for Mobile Apps

Run Personyze campaigns inside your native iOS or Android app — installing the SDK with your App key, optional push notifications, the five campaign steps, and how to validate without a QA step.

7 min read Updated 2 days ago

Everything Personyze does on your website — targeted banners, popups, inline messages, A/B tests — can also run inside your native iOS or Android app. The targeting is identical: the same audience rules, the same visitor profiles, the same data. What changes is delivery. There is no browser to inject HTML into, so content reaches the app through the Personyze SDK and your app renders it.

This is an SDK integration, not a point-and-click campaign. A developer wires up the SDK once; after that, campaigns are created and targeted in the panel with no further code.

In the panel: New campaign › App / API › API & SDK Personalization.

Watch the 1:57 film: a Product Recs for Apps campaign from Set up (the Android, iOS and server code) through Catalog, Content (the JSON feed, a template, how the items are picked, the answer’s format and a sample) and Target to Publish to staging, then a JSON API campaign’s answer. The same film plays on the Set up step of every app campaign.

How it works

  1. The SDK is installed once in your app and initialised with your App key.
  2. The app reports where the user is — screen views and events — through SDK calls. This is what builds the profile that targeting runs against.
  3. Personyze decides what to show, using your audience rules, exactly as it does on web.
  4. Your app renders the result: HTML in a WebView, or JSON laid out with native components.

Because the profile is shared with the website, someone who browsed a category on your site is already known when they open the app.

Installing the SDK

The campaign’s Set up step holds everything below, with your key already filled in. Pick the Platform — Android, iOS or Server (REST) — and copy each card’s code. You connect once; later app campaigns need no setup.

The App key

An app carries its key inside every copy you ship, so the Android and iOS cards hand it the App key, not your account’s API key. The App key can only do what the app SDK does — report screens and events, show what your campaigns decide, receive push notifications — and nothing else. It needs the SDK 2.0 or later.

  • If your account has no App key yet, card 2 shows Create the App key. Press it and the key fills in the code.
  • The same key is listed on Integrations › App push, where you can make another or revoke one.
  • Only the account owner and a Manager see keys. Anyone else gets YOUR_APP_KEY in the code and is told to ask them.
  • An app already released with your account’s API key keeps working as it is.

The Server (REST) platform is your own server, so its card uses your account’s API key (Integrations › Full-featured API), hidden until you press Show key. Keep it on the server.

Android

The SDK is a Kotlin library on Maven Central (Android 7.0, API level 24, or later). In app/build.gradle.kts:

dependencies {
	implementation("com.personyze:personyze-android:2.1.0")
	// to render actions in Jetpack Compose:
	implementation("com.personyze:personyze-android-compose:2.1.0")
}

Initialise it once, in Application.onCreate():

Personyze.initialize(this, PersonyzeConfig("YOUR_APP_KEY") { notifications = true })

Then, once on each screen the user opens:

lifecycleScope.launch {
	val result = Personyze.navigate("MainActivity")
	// result.actions — what to present: PersonyzeActionView, or in Compose
	// PersonyzeActionContent(action); both report what the visitor does
}

The full guide is the Android SDK guide (the card’s Full install guide on GitHub button). The old Java SDK, 1.x, stays on the v1 branch; the guide says how to move from it.

iOS

The SDK is a Swift package (iOS 15 or later). In Xcode, File › Add Package Dependencies…, enter https://github.com/personyze/personyze-ios-sdk and choose Up to Next Major Version from 2.1.0. Or in Package.swift:

.package(url: "https://github.com/personyze/personyze-ios-sdk", from: "2.1.0")

Initialise it once, as the app starts:

Personyze.initialize(PersonyzeConfig(apiKey: "YOUR_APP_KEY") { $0.notifications = true })

Then, once on each screen the user opens:

Task {
	let result = await Personyze.navigate("ViewController")
	// result.actions — what to present: PersonyzeActionView, or in SwiftUI
	// PersonyzeActionContent(action); both report what the visitor does
}

The full guide is the iOS SDK on GitHub. The old single-file SDK, 1.x, stays on its v1 branch; the guide says how to upgrade.

Do not go back to an older SDK once you have shipped a newer one. iOS 2.1 keeps 64-bit visitor ids exactly, and 2.0 cannot read them: an app taken back from 2.1 to 2.0 turns each such visitor into a new one, with a new history and a new A/B arm. See Visitor IDs.

Server (REST)

For a backend rather than an app. A Node.js server installs npm install @personyze/node (Node 20 or later) and asks at each decision point; a PHP or Python server calls the same endpoint over HTTPS with the REST API. Server-side personalization covers it.

Notifications: pushed at once (optional)

A Send Web Push campaign reaches your app’s users too: the SDK shows its notification in your app. Without anything more, the app shows it when it next checks — as it opens, or in the background now and then. To have it reach the phone at once, even with the app closed, upload your Apple push key or Firebase service account on Integrations › App push (the card’s App push keys button), and add the card’s few lines to your app:

  • Android: your own FirebaseMessagingService passes the token on (Personyze.setPushToken) and hands the messages to Personyze.handlePushMessage. The SDK itself depends on no Firebase library.
  • iOS: the app delegate passes the device token on (Personyze.setPushToken), and your notification delegate hands taps to Personyze.handleNotificationResponse. A Notification Service Extension of PersonyzeNotificationService adds the picture and buttons.

Promotions

On an account with Promotions, one more card lists the calls that report what the visitor sees, taps and uses: promotionViewed, promotionClicked, codeRevealed and couponUsed. A view teaches the promotion’s results, a tap counts as its click, and a code used at your checkout is a redemption.

Confirming it works

Once initialised, open the app and check Live visits (Analytics › Recommended for you › Live traffic). If your session appears there, the SDK is talking to Personyze and you can build campaigns against it. If it does not, nothing downstream will work — fix this before going further.

Full SDK reference, including the tracker, condition and action classes, is in the developer documentation.

The campaign steps

Five steps: Set up, Target, Content, Automation and Performance.

Note there is no QA step on app campaigns. The on-site preview and simulator tools cannot drive a native app, so validation happens in a build of your app rather than in the panel — see below.

1. Set up

Connects the SDK: the Platform choice and the cards described above — Add the library, Initialize it with your App key, Report each screen, and present what comes back, then the optional Notifications: pushed at once (optional) and, on an account with Promotions, Promotions: report what the visitor sees, taps and uses. On Server (REST) they are Add the client library, Initialize it with your API key and Ask at each decision point, and report what you did.

2. Target

The same audience rules as web: behaviour, profile and CRM fields, interests, geography, session context. What the app reports through navigate() and its event calls is what these rules can see, so the granularity of your targeting follows the granularity of your instrumentation. Because each screen is reported by name, a campaign can target one screen rather than the whole app.

3. Content

What to show. For apps this is usually one of two shapes:

  • HTML — rendered in a WebView. Fastest to build, and marketers can change it without an app release.
  • JSON — Personyze returns structured data and you lay it out with native components. More work up front, and the result looks and feels native.

4. Automation

This step is optional. Add rules that alert you, or act, when this campaign’s numbers cross a line. See Automation.

5. Performance

The Performance step’s General tab shows the visits of the visitors the campaign matched, how often its content was viewed and clicked, and their conversion rate. Conversions and audience revenue are the audience view: they count what matched visitors did, not only what the content caused, so they cannot be added across campaigns. See One campaign’s Performance step.

Validating without a QA step

Because there is no in-panel QA, test in a build:

  1. Confirm your device shows up in Live visits.
  2. Temporarily widen the audience so it certainly matches you, and check the content arrives.
  3. Narrow the rules back and confirm it stops arriving.

That third step is the one people skip, and it is the one that catches a rule that matches everybody.

Get an AI plan for your site

Inspire me reads your website and suggests the personalization campaigns to run first, and who should see each one. Free.

Scan your site
Did this page answer your question?
Thank you — that goes to whoever maintains this page.