@@ -28,6 +28,7 @@ send them timely push notifications via [FCM (Firebase Cloud Messaging)](https:/
2828 - [ Collecting Push Tokens] ( #collecting-push-tokens )
2929 - [ Receiving Push Notifications] ( #receiving-push-notifications )
3030 - [ Rich Push] ( #rich-push )
31+ - [ Push Action Buttons] ( #push-action-buttons )
3132 - [ Tracking Open Events] ( #tracking-open-events )
3233 - [ Silent Push Notifications] ( #silent-push-notifications )
3334 - [ Custom Data] ( #custom-data )
@@ -37,6 +38,7 @@ send them timely push notifications via [FCM (Firebase Cloud Messaging)](https:/
3738 - [ Setup] ( #setup-1 )
3839 - [ In-App Forms Session Configuration] ( #in-app-forms-session-configuration )
3940 - [ Unregistering from In-App Forms] ( #unregistering-from-in-app-forms )
41+ - [ Monitoring Form Lifecycle Events] ( #monitoring-form-lifecycle-events )
4042- [ Geofencing] ( #geofencing )
4143 - [ Setup] ( #setup-2 )
4244 - [ Requesting Permissions] ( #requesting-permissions )
@@ -103,10 +105,10 @@ The sample app serves as both a reference implementation and a testing tool for
103105 ```kotlin
104106 // build.gradle.kts
105107 dependencies {
106- implementation("com.github.klaviyo.klaviyo-android-sdk:analytics:4.3.2 ")
107- implementation("com.github.klaviyo.klaviyo-android-sdk:push-fcm:4.3.2 ")
108- implementation("com.github.klaviyo.klaviyo-android-sdk:forms:4.3.2 ")
109- implementation("com.github.klaviyo.klaviyo-android-sdk:location:4.3.2 ")
108+ implementation("com.github.klaviyo.klaviyo-android-sdk:analytics:4.4.0 ")
109+ implementation("com.github.klaviyo.klaviyo-android-sdk:push-fcm:4.4.0 ")
110+ implementation("com.github.klaviyo.klaviyo-android-sdk:forms:4.4.0 ")
111+ implementation("com.github.klaviyo.klaviyo-android-sdk:location:4.4.0 ")
110112 }
111113 ```
112114 </details>
@@ -117,10 +119,10 @@ The sample app serves as both a reference implementation and a testing tool for
117119 ```groovy
118120 // build.gradle
119121 dependencies {
120- implementation "com.github.klaviyo.klaviyo-android-sdk:analytics:4.3.2 "
121- implementation "com.github.klaviyo.klaviyo-android-sdk:push-fcm:4.3.2 "
122- implementation "com.github.klaviyo.klaviyo-android-sdk:forms:4.3.2 "
123- implementation "com.github.klaviyo.klaviyo-android-sdk:location:4.3.2 "
122+ implementation "com.github.klaviyo.klaviyo-android-sdk:analytics:4.4.0 "
123+ implementation "com.github.klaviyo.klaviyo-android-sdk:push-fcm:4.4.0 "
124+ implementation "com.github.klaviyo.klaviyo-android-sdk:forms:4.4.0 "
125+ implementation "com.github.klaviyo.klaviyo-android-sdk:location:4.4.0 "
124126 }
125127 ```
126128 </details>
@@ -479,6 +481,11 @@ attaching it to the notification is handled within `KlaviyoPushService`. If an i
479481(e.g. if the device has a poor network connection) the notification will be displayed without an image
480482after the download times out.
481483
484+ #### Push Action Buttons
485+ [ Push Action Buttons] ( https://help.klaviyo.com/hc/en-us/article/46285872166683 ) provide the ability to add clickable buttons to
486+ push notification messages. These buttons can show custom text, and, when clicked, deep link or open your app.
487+ A notification can include up to 3 buttons. No additional SDK setup is required.
488+
482489#### Tracking Open Events
483490To track push notification opens, you must call ` Klaviyo.handlePush(intent) ` when your app is launched from an intent.
484491This method will check if the app was opened from a notification originating from Klaviyo and if so, create an
@@ -695,6 +702,7 @@ See the table below to understand available features by SDK version.
695702| Time Delay | 4.0 .0 |
696703| Audience Targeting | 4.0 .0 |
697704| Event Triggers | 4.1 .0 |
705+ | Form Lifecycle Hooks | 4.4 .0 |
698706
699707### Setup
700708To begin, call `Klaviyo .registerForInAppForms()` after initializing the SDK with your public API key.
@@ -787,6 +795,76 @@ object to the `registerForInAppForms()` method. For example, to set a session ti
787795
788796** Note : ** After unregistering, the next call to `registerForInAppForms()` will be considered a new session by the SDK .
789797
798+ ### Monitoring Form Lifecycle Events
799+
800+ > Form lifecycle events are available in SDK version 4.4 .0 and higher.
801+
802+ You can register a handler to receive callbacks whenever a form is shown, dismissed, or a CTA button is tapped.
803+ This is useful for forwarding engagement data to a third- party analytics platform such as Amplitude , Segment , or Mixpanel .
804+
805+ The handler is invoked on the ** main thread** , so avoid performing long- running or blocking work inside it.
806+
807+ < details open>
808+ < summary> Kotlin < / summary>
809+
810+ ```kotlin
811+ import com.klaviyo.analytics.Klaviyo
812+ import com.klaviyo.forms.FormLifecycleEvent .FormCtaClicked
813+ import com.klaviyo.forms.FormLifecycleEvent .FormDismissed
814+ import com.klaviyo.forms.FormLifecycleEvent .FormShown
815+ import com.klaviyo.forms.registerFormLifecycleHandler
816+ import com.klaviyo.forms.unregisterFormLifecycleHandler
817+
818+ Klaviyo .registerFormLifecycleHandler { event ->
819+ when (event) {
820+ is FormShown -> {
821+ // e.g. myAnalytics.track("Form Shown", mapOf("formId" to event.formId, "formName" to event.formName))
822+ }
823+ is FormDismissed -> {
824+ // e.g. myAnalytics.track("Form Dismissed", mapOf("formId" to event.formId, "formName" to event.formName))
825+ }
826+ is FormCtaClicked -> {
827+ // e.g. myAnalytics.track("Form CTA Clicked", mapOf(
828+ // "formId" to event.formId,
829+ // "formName" to event.formName,
830+ // "buttonLabel" to event.buttonLabel,
831+ // "deepLinkUrl" to event.deepLinkUrl.toString()
832+ // ))
833+ }
834+ }
835+ }
836+
837+ // To stop receiving events, unregister the handler
838+ Klaviyo .unregisterFormLifecycleHandler()
839+ ```
840+ < / details>
841+
842+ < details>
843+ < summary> Java < / summary>
844+
845+ ```java
846+ import com.klaviyo.forms.FormLifecycleEvent ;
847+ import com.klaviyo.forms.KlaviyoForms ;
848+
849+ KlaviyoForms .registerFormLifecycleHandler(event -> {
850+ if (event instanceof FormLifecycleEvent .FormShown shown) {
851+ // e.g. myAnalytics.track("Form Shown", ...)
852+ } else if (event instanceof FormLifecycleEvent .FormDismissed dismissed) {
853+ // e.g. myAnalytics.track("Form Dismissed", ...)
854+ } else if (event instanceof FormLifecycleEvent .FormCtaClicked ctaClicked) {
855+ // e.g. myAnalytics.track("Form CTA Clicked", ...)
856+ }
857+ });
858+
859+ // To stop receiving events, unregister the handler
860+ KlaviyoForms .unregisterFormLifecycleHandler();
861+ ```
862+ < / details>
863+
864+ Registering a lifecycle handler is optional and does not affect normal form behavior — forms are displayed and dismissed
865+ regardless of whether a handler is registered. Only one handler can be registered at a time; calling
866+ `registerFormLifecycleHandler` again replaces the previous registration.
867+
790868## Geofencing
791869
792870[Geofencing ](https: // help.klaviyo.com/hc/en-us/articles/45194892526747) allows you to trigger events when users enter or exit geographic regions defined in your Klaviyo account.
0 commit comments