Skip to content

trackingplan/trackingplan-ios

Repository files navigation

Trackingplan iOS SDK

With Trackingplan for iOS you can make sure that your tracking is going as you planned without changing your current analytics stack or code.

Trackingplan will monitor traffic between your app and data destinations and automatically detect any changes in your analytics implementation and warn you about inconsistencies like hit drops, missing properties, rogue events, and more.

Trackingplan is currently available for Web, iOS and Android. More clients will come soon.

Please request your TrackingplanId at trackingplan.com or write us directly team@trackingplan.com.

Install the SDK

The recommended way to install Trackingplan for iOS is using Swift Package Manager because it makes it simple to install and upgrade.

First, add the Trackingplan dependency using Xcode, like so:

In Xcode, go to File -> Swift Packages -> Add Package Dependency...

If you are asked to choose the project, please choose the one you want to add Trackingplan to.

In the search box please put https://github.com/trackingplan/trackingplan-ios and click next.

Choose the Version and leave the default selection for the latest version or customize if needed.

Click finish and you will see the library added to the Swift Package Dependencies section.

Then in your application delegate’s - application(_:didFinishLaunchingWithOptions:) method, set up the SDK like so:

// AppDelegate.swift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    // Override point for customization after application launch.

    // Initialize Trackingplan SDK
    Trackingplan.initialize(tpId: "#YourTrackingplanId")

    return true
}

And of course, import the SDK:

// AppDelegate.swift
import Trackingplan

All set!

Using tags

Tags are a pair of key-value strings that will be used for tagging data sent to Trackingplan. They can be used from your Trackingplan dashboard for debuging purposes, for example, to filter warnings affecting a specific app version, country and so on.

Example

// Initialize Trackingplan SDK
Trackingplan.initialize(
    tpId: "#YourTrackingplanId",
    tags: [
        // "app_version": "1.0.0", Omitted, this is automatically set
        "lang": "en",
        "country": "us"
    ]
)

Environment

You can set environment in runtime using the tag builder environment app.launchEnvironment.updateValue(value, forKey: TrackingplanTag.environment.rawValue)

Can I install SDK using Cocoapods?

Yes, we also sopport installation using Cocoapods.

First, add the Trackingplan dependency to your Podfile, like so:

pod 'Trackingplan', :git => 'https://github.com/trackingplan/trackingplan-ios.git'

Then in your application delegate’s - application(_:didFinishLaunchingWithOptions:) method, set up the SDK like so:

// AppDelegate.swift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.

        // Initialize Trackingplan SDK
        TrackingplanTag.initialize(tpId: "#YourTrackingplanId")

        return true
}

And of course, import the SDK:

// AppDelegate.swift
import TrackingplanTag

All set!

Need help?

Questions? Problems? Need more info? We can help! Contact us here.

Learn more

Visit www.trackingplan.com

License

Copyright © 2021 Trackingplan Inc. All Rights Reserved.