|
40 | 40 | - [Setup](#setup-1) |
41 | 41 | - [In-App Forms Session Configuration](#in-app-forms-session-configuration) |
42 | 42 | - [Unregistering from In-App Forms](#unregistering-from-in-app-forms) |
| 43 | + |
| 44 | + - [Geofencing](#geofencing) |
| 45 | + - [Prerequisites](#prerequisites-2) |
| 46 | + - [Setup](#setup-2) |
| 47 | + - [Unregistering from Geofencing](#unregistering-from-geofencing) |
43 | 48 | - [Troubleshooting](#troubleshooting) |
44 | 49 | - [Contributing](#contributing) |
45 | 50 | - [License](#license) |
@@ -591,6 +596,49 @@ Klaviyo.unregisterFromInAppForms(config); |
591 | 596 |
|
592 | 597 | Note that after unregistering, the next call to `registerForInAppForms()` will be considered a new session by the SDK. |
593 | 598 |
|
| 599 | +## Geofencing |
| 600 | + |
| 601 | +> ℹ️ Support for Geofencing is currently available for early access to select Klaviyo customers. Please contact your CSM to be enrolled. |
| 602 | +
|
| 603 | +> Alpha geofencing support is available in SDK version 2.2.0-alpha.1 and higher. |
| 604 | +
|
| 605 | +Geofencing allows you to trigger events when users enter or exit geographic regions. The Klaviyo SDK monitors geofences configured in your Klaviyo account and automatically tracks geofence enter and exit events. The SDK automatically handles geofence synchronization with your Klaviyo account—when you add, update, or remove geofences in Klaviyo, the SDK will automatically sync these changes on the next app launch or when the API key changes. |
| 606 | + |
| 607 | +### Prerequisites |
| 608 | + |
| 609 | +Integrating geofencing is highly platform-specific as it utilizes the native monitoring systems. Begin by thoroughly reviewing the setup |
| 610 | +instructions for Geofencing in the README from each native Klaviyo SDK: |
| 611 | + |
| 612 | +- [Android](https://github.com/klaviyo/klaviyo-android-sdk/tree/rel/4.2.0-rc.1?tab=readme-ov-file#geofencing) |
| 613 | +- [iOS](https://github.com/klaviyo/klaviyo-swift-sdk/tree/rel/5.2.0-alpha.1?tab=readme-ov-file#geofencing) |
| 614 | + |
| 615 | +### Setup |
| 616 | + |
| 617 | +To enable geofencing in your app, you must: |
| 618 | + |
| 619 | +1. Configure location permissions in your app's platform-specific configuration files |
| 620 | +2. Call `Klaviyo.registerGeofencing()` after initializing the SDK |
| 621 | + |
| 622 | +4. Register for geofencing after initializing the SDK: |
| 623 | + ```typescript |
| 624 | + import { Klaviyo } from 'klaviyo-react-native-sdk'; |
| 625 | + |
| 626 | + // After initializing with your public API key |
| 627 | + Klaviyo.registerGeofencing(); |
| 628 | + ``` |
| 629 | + |
| 630 | +### Unregistering from Geofencing |
| 631 | + |
| 632 | +If at any point you need to stop monitoring geofences, e.g. when the user logs out or opts out of location tracking, you may call: |
| 633 | + |
| 634 | +```typescript |
| 635 | +import { Klaviyo } from 'klaviyo-react-native-sdk'; |
| 636 | + |
| 637 | +Klaviyo.unregisterGeofencing(); |
| 638 | +``` |
| 639 | + |
| 640 | +After unregistering, the SDK will stop monitoring geofences and will no longer report geofence transition events. You can call `registerGeofencing()` again to resume monitoring. |
| 641 | + |
594 | 642 | ## Troubleshooting |
595 | 643 |
|
596 | 644 | Use the [troubleshooting guide](Troubleshooting.md) to resolve common issues with the Klaviyo React Native SDK. |
|
0 commit comments