Triggering Referral Prompts at the Perfect Moment with Amply
02 Mar 2025
You built a referral program. You added a "Share with friends" button somewhere in the settings menu. Maybe you even offered a reward. And yet, your K-factor barely budges. Your customer acquisition cost keeps climbing, and organic growth remains a dream on a roadmap slide. Sound familiar?
Here's the uncomfortable truth: the problem isn't your referral program. It's when you ask. Word-of-mouth is one of the strongest acquisition channels in mobile — but showing an invite screen at the wrong moment means it gets dismissed, ignored, or worse, creates friction that drives users away.
In this article, we'll walk through how to trigger referral prompts at the exact moment users are most likely to say yes — and how to wire it all up with Amply's event-driven campaign engine. No guesswork, no static timers, just behavioral precision.
The Science of Perfect Timing
When do people recommend things they love? Not when you interrupt them. Not when you pop up a modal during onboarding. They recommend things at emotional peaks — the moment right after something genuinely good happens.
Behavioral psychology calls this the "peak-end rule": people judge experiences primarily by how they felt at the most intense moment and at the end. If you surface a referral prompt during one of those peaks, you're riding a wave of positive emotion rather than fighting against indifference.
Invites asked right after a positive experience ride a wave of existing emotion. Random or time-based prompts fight against indifference — which is why timing, not copy, is usually the biggest lever.
The challenge is identifying these peaks programmatically. That's where event-driven triggering comes in — and it's exactly what Amply was built for.
Identifying "Positive Moments" in Your App
Every app has moments where users feel a surge of accomplishment, satisfaction, or delight. The key is mapping those moments explicitly and instrumenting them as trackable events. Here are examples across different app categories:
- Gaming: Beating a boss, unlocking a rare item, completing a level streak
- Fitness: Hitting a 7-day workout streak, setting a personal record, reaching a weight goal
- E-commerce: Successful order delivery, receiving a discount reward, earning loyalty points
- Finance: Completing a savings goal, first successful investment return, bill paid on time
- Productivity: Finishing all daily tasks, hitting a usage milestone, completing a project
The common thread? Each of these is a concrete, detectable event that correlates with positive user sentiment. In Amply, you'll track all of them under a unified PositiveMoment event with parameters that describe the specific trigger.
Building Event-Driven Referral Campaigns with Amply
Traditional referral implementations are static: a button in the menu, maybe a banner on the home screen. Amply flips this model by letting you define campaigns that react to user behavior in real time. Here's how a referral campaign works:
Step 1: Define the Trigger Event
In the Amply dashboard, set your campaign trigger to the PositiveMoment event. This means the referral prompt will only appear immediately after your app fires that event — not on a timer, not on a screen load, but at the exact moment the user feels good.
Step 2: Set the Deeplink Action
Configure the campaign action as a deeplink to happens://invite-friends. When the campaign triggers, Amply's SDK delivers this deeplink to your app, and your deeplink handler opens the referral screen. No hardcoded navigation paths, no feature flags to manage — just a clean event-to-screen pipeline.
Step 3: Configure Impression Limits
You don't want to bombard users with referral prompts after every single achievement. In Amply, set the impression limit to 1 per device after the trigger event. You can also add a minimum time interval between impressions to keep things non-intrusive. One well-timed ask is worth more than ten annoying ones.
Targeting the Right Users
Not every user who hits a positive moment is the right candidate for a referral prompt. A first-session user who just completed the tutorial hasn't built enough loyalty to recommend your app. Someone who already invited friends doesn't need to see the prompt again. Amply's targeting rules let you be precise:
- Returning users only: In the When step, use Repeat Rules mode
onwith chips6, 7, 8scopegloballyso only the 6th, 7th, and 8th matching events trigger the campaign. Or use modeeverywith chip2scopegloballyif you want the prompt to keep appearing periodically after the first trigger. First-time visitors never see the prompt either way. - Suppress users who already invited: When your app fires
InviteSent, also callAmplySDK.setCustomProperties(mapOf("has_invited" to true)). Then in the campaign's Who step, filter onhas_invited != trueso users who have already sent an invite never see the prompt again. - Event parameter matching: Want to only trigger for specific achievement types? You can match on event parameters — for example, only show the referral prompt when the
PositiveMomenttype isachievementand the name matches7_day_streak.
This combination ensures your referral prompt reaches exactly the right audience: loyal users who are emotionally primed and haven't been asked before. Precision inwho and when is usually what separates an invite prompt that feels like background noise from one that actually moves the K-factor.
Code Implementation
Let's get into the code. The Amply SDK integration for a referral campaign requires three pieces: tracking positive moments, tracking invite completions, and handling the deeplink.
Track Positive Moments
Fire the PositiveMoment event wherever your app detects a peak experience. Include parameters so you can filter campaigns by achievement type in the Amply dashboard:
// Android (Kotlin). 'amply' is the Amply instance created in your Application class.
// When user completes a 7-day streak
amply.track("PositiveMoment", mapOf(
"type" to "achievement",
"name" to "7_day_streak"
))
// When user completes a successful purchase
amply.track("PositiveMoment", mapOf(
"type" to "transaction",
"name" to "purchase_complete"
))
// When user beats a game level
amply.track("PositiveMoment", mapOf(
"type" to "achievement",
"name" to "level_cleared"
))Track Invite Completions
When a user actually sends a referral, track the InviteSent event. This is what Amply's negative targeting uses to suppress the prompt for users who have already invited friends:
// Android (Kotlin). After user successfully shares a referral link.
amply.track("InviteSent")
amply.setCustomProperties(mapOf(
"has_invited" to true
))Campaign Configuration
Here is the full campaign configuration in the Amply dashboard:
Referral prompt after a positive moment
- WhoCustom Property—
has_invited(Boolean)!= not equaltrue - WhenTriggering Event— event
PositiveMomentwith event parameterstype= equalachievementANDname= equal7_day_streak - WhenFrequency Limits— show campaign
2times, time interval between impressions at least7days - WhatDeeplink—
happens://invite-friends

Handle the Referral Deeplink
Register a deeplink handler with the Amply SDK. When the campaign fires, the SDK delivers the happens://invite-friends deeplink, and your handler navigates to the referral screen:
// Android (Kotlin). Register once, e.g. in your Application or a lifecycle-aware component.
import tools.amply.sdk.actions.DeepLinkListener
amply.registerDeepLinkListener(object : DeepLinkListener {
override fun onDeepLink(url: String, info: Map<String, Any>): Boolean {
if (url.contains("invite-friends")) {
showReferralScreen()
return true
}
return false
}
})That's it — three small integration points. The campaign logic, targeting rules, impression limits, and timing are all managed in the Amply dashboard. No app update required to adjust when, how often, or to whom the referral prompt appears.
Results You Can Expect
Teams that switch from static referral prompts to event-driven, behaviorally-targeted campaigns consistently see dramatic improvements:
- Materially higher invite acceptance: When you ask at the right moment, users say yes far more often than to untimed prompts. The emotional peak does the heavy lifting — Amply lets you measure exactly how much in your app.
- Lower CAC through organic growth: Every successful referral is a user you didn't pay to acquire. As your K-factor improves, your reliance on paid channels decreases.
- Higher quality referred users: Users who arrive through a friend tend to retain better and monetize better than users acquired through paid channels, because they come in with context and social proof a banner ad cannot provide.
- Zero user annoyance: With impression limits and negative targeting, users never see the referral prompt more than once, and only after a positive experience. No interruptions, no spam.
The best referral programs don't feel like marketing. They feel like a natural extension of a great experience.
Conclusion
Your referral program isn't broken — its timing is. The difference between a referral prompt that gets ignored and one that drives viral growth comes down to a single question: did you ask when the user was feeling great about your app?
With Amply, you can stop guessing and start targeting. Track your app's positive moments as events, set up a campaign that triggers on those events, target loyal users who haven't invited friends yet, and let the SDK handle the rest. The result is a referral engine that works with user psychology instead of against it.
Ready to turn your happiest moments into your best growth channel? Set up your first event-driven referral campaign in the Amply dashboard today.