Campaigns

Campaigns are the core feature of Amply SDK for delivering targeted, contextual experiences to your users. This guide explains how campaigns work and how to leverage them effectively.

Campaign Structure

Every campaign consists of three main parts:

Campaign
├── Targeting (WHO) - Which users should see this campaign
├── Triggering (WHEN) - What events activate the campaign
└── Actions (WHAT) - What happens when triggered

Targeting Rules

Targeting rules determine which users are eligible for a campaign. Rules are evaluated against datasets using Amply expressions.

Available Datasets for Targeting

Dataset
Key
Example Properties

Device

@device

model, osVersion, platform, idfa, idfv

User

@user

Custom user properties

Session

@session

counter (session count)

Example Targeting Rules

Target iOS users only:

Target users with 3+ sessions:

Target specific OS versions:

Triggering Rules

Triggering rules define when a campaign should activate. They evaluate against event data.

Available Datasets for Triggering

Dataset
Key
Properties

Triggered Event

@triggeredEvent

name, counter, sessionCounter, params, type

Events

@events

data (array of event records)

Event counters can use different strategies:

Strategy
Scope
Use Case

global

All time

"After 10th purchase ever"

session

Current session

"After 3rd view this session"

Actions

Actions define what happens when a campaign is triggered. Each campaign can have multiple actions with their own conditions.

Action Types

Deep Link: Opens a URL or Deeplink

Rate Review: Prompts the user to rate the app using platform RateReview:

circle-info

Note: On Android, the Play Store in-app review API only works in Play Store-distributed release builds. Debug builds show a simulated dialog.

Register a listener to handle deep link actions:

Campaign Evaluation Flow

Best Practices

  • Start with targeting — define your audience before triggers.

  • Use session counters for frequency — avoid showing the same campaign too often.

  • Test with device datasets — use getDataSetSnapshot() to verify data.

  • Handle deep links gracefully — always have fallback behavior.

  • Log campaign triggers — use system events listener for debugging.

Last updated