Getting Started with iOS Data Capture

Available for the following Plan types:

FullStory Enterprise*

FullStory Advanced*

FullStory Business*

FullStory Free

*with the following add-on:

FullStory for Mobile Apps

Available to the following User roles:

Admin

Architect

Standard

 

Using native data capture on iOS requires adding the FullStory capture framework to your app. You can add the FullStory framework to your app in several ways. Choose the approach that best integrates with your existing app build and follow the setup instructions linked below.  

As you're implementing the instructions below, you may find it useful to reference a sample app with FullStory integrated. We have an example of the SDK being implemented into an iOS app here.

Adding the FullStory framework

Adding FullStory as a Swift Package
Adding FullStory as a CocoaPods Pod
Adding the FullStory Framework Manually

Configure FullStory

To complete the FullStory integration, you need to tell the framework which FullStory organization to capture data to.

  • Open your app's Info.plist
  • From the menu, choose Editor > Add Item.  Set the key name to FullStory, and the type to "Dictionary".
  • Right click on the FullStory row, and choose "Add Row".  Set the key name to OrgId, and the type to "String".  For the value, paste in your assigned organization ID.

When configured correctly, the Info.plist entry should look as follows:

image (63).png

(Note that these instructions have changed in 1.18.0. However, old integrations that use the FSOrgId key will continue to work.)

Using FullStory's Advanced Features

Identifying users and passing custom data to FullStory

On the web, FullStory offers the FS.identify and FS.setUserVars JavaScript functions to enable you to enrich your FullStory data with additional variables for use in searches, segments, and integrations. This functionality is replicated on iOS to allow you to pass user information to FullStory directly from your native app. The methods behave identically to their JavaScript counterparts linked above. The parameters are simply the Objective-C/Swift equivalents of the original JavaScript parameters:

Objective-C

  • [FS identify:userVars:] takes a NSString and an optional NSDictionary<NSString *, id>
  • [FS setUserVars:] takes a NSDictionary<NSString *, id>

Swift

  • FS.identify(_:userVars:) takes a String and an optional [String : Any]
  • FS.setUserVars(_:) takes a [String : Any]

Preventing FullStory from automatically capturing data on startup

Added in version: 1.5.1
By default, FullStory will automatically request a session and start data capture on app startup. If you need to capture data within the app once certain conditions are met, then you can use the new RecordOnStart feature. Configuring FullStory to not RecordOnStart will prevent data capture until you explicitly invoke FS.restart.

To prevent FullStory from capturing data on start, in your app’s Info.plist's FullStory dictionary, add a RecordOnStart key, of type Boolean, with a value of NO or 0.

(Note that these instructions are new as of version 1.18.0.  However, old integrations that use the older FSRecordOnStart key will continue to work.)

Configuring a Relay server

Added in version: 1.37.0

By default, FullStory routes traffic through "https://fullstory.com." To instead route FullStory traffic through a Relay server, you may add a ServerUrl key to the FullStory dictionary in your app's Info.plist, of type String, with a value of your server's url.

FullStory Delegate

You can implement the FullStory Delegate protocol FSDelegate to be notified about the session lifecycle.

Objective-C

// File: Appdelegate.m

// Set the FS delegate in `didFinishLaunchingWithOptions`
FS.delegate = self;

// Implement the optional methods
- (void)fullstoryDidTerminateWithError:(NSError *)error {}
- (void)fullstoryDidStartSession:(NSString *)sessionUrl {}
- (void)fullstoryDidStopSession {}

Identify

Identify is used to associate your own application-specific id with the active user.

Objective-C

NSString *userId = @"13ff474bae77"; // replace with your user’s Id
NSDictionary *info = @{
@"email": @"user@example.com",
@"displayName": @"Shopping User"
};

[FS identify:userId userVars:info];


Swift

In order for FullStory to be imported and used in Swift you’ll need to make sure that you’ve configured an Objective-C bridging header and @import FullStory; in the bridging header. See Apple’s Importing Objective-C into Swift documentation for help with adding the header.

let userId = "13ff474bae77" // replace with your user’s Id
let info = ["email": "user1@example.com",
"displayName": "Shopping User"
]
FS.identify(userId, userVars: info)

Additional topics

FullStory for Mobile Apps Privacy rules

For more information about configuring privacy rules and masking, please consult our FullStory for Mobile Apps Privacy Rules guide. 

FullStory for SwiftUI Apps

For customers who are already familiar with using FullStory on iOS with UIKit or React Native apps, FullStory’s SwiftUI support is a bit different. To learn more, read our article What's Different in FullStory for SwiftUI? Or the how-to companion article, Integrating FullStory into a SwiftUI App.

Turning mobile data capture on or off

Mobile data capture can be toggled on or off from Settings > Data Capture and Privacy > Mobile Data Capture. This applies across your entire FullStory account.

UI Framework Support

FullStory for Mobile Apps works best with native UIKit and with React Native applications. If you're using another framework to build your app's UI, including SwiftUI, please reach out to your Account Executive or to our Support team to make sure that we can support your use case.

Configuring domain allowlisting for WebViews

If your application makes use of WebViews, you must explicitly allowlist any domain you wish to capture within a WebView. For security and privacy reasons, you should only allowlist domains which are under your control. Wildcards and subdomains are supported using the same scheme as Web domain settings. The key difference between the Web and Mobile settings is that while domain allowlisting is optional on Web, it is mandatory on Mobile if you wish to capture content within WebViews. If your application doesn’t use WebViews or you don’t care to capture within WebViews, you can safely ignore this section.

These settings can be configured from Settings > Data Capture and Privacy > Mobile Data Capture.

Note:  We recommend using WKWebView containers for all webview content to ensure effective data capture. FullStory cannot inject our capture snippet into SFSafariViewController containers. 

Asset Uploading for WebViews

By default, the FullStory build-time tool for iOS (FullStoryCommandLine) uploads image assets that are part of the Assets.car files. Additionally, it searches inside the .app bundle for image assets of file types .jpg, .jpeg and .png within the /assets directory, and also resources of file type .css within the /www directory. For a refresher on the standard iOS app bundle directory hierarchy, consult Apple’s documentation.

Applications that use web technologies heavily (or that include image files outside of an Assets.car) may need to upload other assets in order for playback to work correctly. To configure the tool to look for additional file types and/or in different directories, you will add an entry in the FullStory dictionary of your Info.plist named IncludeAssets.

  • Right click on the FullStory row within Info.plist, and choose "Add Row". Set the key name to IncludeAssets, and the type to "Dictionary".
  • Right click on the IncludeAssets row, and choose "Add Row".  Set the key name to the directory name, and the type to "Array". You only need to add a root directory, as the FullStory build-time tool will recursively search any child directories.
  • Right click on the directory row and choose "Add Row".  Set the value to the extension of the file type you want to include. You may add multiple file types. Repeat this process for each additional directory.

Below is an example that includes css files in any directories under <bundleroot>/my_directory, and any css, ttf, and jpeg files under <bundleroot>/my_other_directory:

assets.png

How you can integrate FullStory Logs with your iOS App Logging Framework

Data Capture Logs can help you troubleshoot app issues, as well as uncover unintended behavior. In this guide, we're going to review a few popular logging frameworks and how you can integrate them with FullStory.

Impact on App Size

For apps downloaded from the App Store, FullStory’s framework adds ~ 9MB to your uncompressed app size on device but only ~ 2.8MB to your compressed download size. (Note that compression rates can vary by app.)

Since iOS 9.0 when App Thinning was introduced, the App Store will automatically slice your app into different variants for all devices targeted. In each variant, executables and resources for unsupported architectures or screen sizes are automatically removed.

If your app targets both 32-bit and 64-bit devices (true for iOS 10 or earlier), your App Store submission will include both armv7 and arm64 versions of FullStory.framework (~ 18MB, uncompressed). However, when your users download your app, they’ll only receive the version of FullStory.framework that matches their device (~ 9MB, uncompressed).

Note that FullStory.framework will occupy more space in developer builds. We ship a universal framework that includes a variant for each architecture we support. Currently, that’s arm64, armv7, and x86_64. The full universal framework adds ~ 29MB uncompressed to your app, but that’s because app thinning / slicing doesn’t happen for developer builds.

To learn more about how app thinning impacts app size, see Getting an App Size Report in Technical Q&A QA1795.

 

Need to get in touch with us?

The FullStory Team awaits your every question.

Ask the Community Technical Support