mirror of
https://github.com/BillyOutlast/posthog.com.git
synced 2026-02-04 03:11:21 +01:00
* split ios sdk pages * Update contents/docs/libraries/ios/index.mdx Co-authored-by: Ian Vanagas <34755028+ivanagas@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Ian Vanagas <34755028+ivanagas@users.noreply.github.com> * review comments * Autocapture, config table * Apply suggestion from @ivanagas Co-authored-by: Ian Vanagas <34755028+ivanagas@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Ian Vanagas <34755028+ivanagas@users.noreply.github.com> * Unique import names * Address comments --------- Co-authored-by: Ian Vanagas <34755028+ivanagas@users.noreply.github.com> Co-authored-by: Eli Kinsey <eli@ekinsey.dev>
67 lines
3.1 KiB
Plaintext
67 lines
3.1 KiB
Plaintext
---
|
|
title: iOS
|
|
sidebarTitle: iOS
|
|
sidebar: Docs
|
|
showTitle: true
|
|
github: 'https://github.com/PostHog/posthog-ios'
|
|
icon: >-
|
|
https://res.cloudinary.com/dmukukwp6/image/upload/posthog.com/contents/images/docs/integrate/ios.svg
|
|
features:
|
|
eventCapture: true
|
|
userIdentification: true
|
|
autoCapture: true
|
|
sessionRecording: true
|
|
featureFlags: true
|
|
groupAnalytics: true
|
|
surveys: true
|
|
llmAnalytics: false
|
|
---
|
|
|
|
import IOSInstall from '../../integrate/_snippets/install-ios.mdx'
|
|
import IOSIdentify from './_snippets/identify.mdx'
|
|
import IOSSendEvents from '../../integrate/send-events/_snippets/send-events-ios.mdx'
|
|
|
|
The PostHog iOS SDK is a library that you can use to track events, identify users, record session replays, evaluate feature flags, run experiments, build surveys, and more.
|
|
|
|
This page shows you how to install the SDK and get started with it. If you've already installed the SDK, you can skip ahead to learn about [using the features](/docs/libraries/ios/usage) and [configuring the SDK](/docs/libraries/ios/configuration).
|
|
|
|
## Installation
|
|
|
|
<IOSInstall />
|
|
|
|
## Offline behavior
|
|
|
|
The PostHog iOS SDK will continue to capture events when the device is offline. The events are stored in a queue in the device's file storage and are flushed when the device is online.
|
|
|
|
- The queue has a maximum size defined by `maxQueueSize` in the configuration.
|
|
- When the queue is full, the oldest event is deleted first.
|
|
- The queue is flushed only when the device is online.
|
|
|
|
You can find the options for configuring the offline behavior in the [configuration page](/docs/libraries/ios/configuration#all-configuration-options).
|
|
|
|
## Using PostHog with application extensions
|
|
|
|
PostHog supports sharing analytics data between your main app and application extensions (such as widgets, app clips, share extensions, and custom keyboards) through App Groups. This ensures that users maintain the same identity across all parts of your app ecosystem.
|
|
|
|
By default, each iOS app target stores its data in its own sandboxed directory. This means that if a user interacts with your main app and then uses a widget or extension, PostHog would treat them as two different anonymous users. This can lead to:
|
|
|
|
- Inflated user counts in your analytics
|
|
- Fragmented user journeys
|
|
- Difficulty tracking feature adoption across your app ecosystem
|
|
|
|
[Learn more about setting up app groups](/docs/libraries/ios/configuration#setting-up-app-groups).
|
|
|
|
## Method swizzling
|
|
|
|
The PostHog iOS SDK uses method swizzling to intercept and modify method calls at runtime to provide advanced features like screen view tracking, element interactions, session replay, surveys, and more.
|
|
|
|
Method swizzling is particularly important for accurate session metrics tracking. When disabled, the SDK cannot capture optimal session metrics.
|
|
|
|
You can learn more about configuring method swizzling in the [configuration page](/docs/libraries/ios/configuration#method-swizzling).
|
|
|
|
## Next steps
|
|
|
|
Now that you've installed the SDK, explore the configuration and usage options:
|
|
|
|
- [Learn about using all of the features of PostHog with iOS SDK](/docs/libraries/ios/usage)
|
|
- [Learn about configuration options for the iOS SDK](/docs/libraries/ios/configuration) |