Skip to content

primedata-ai/analytics-ios

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Analytics

Circle CI Version License codecov Carthage compatible SwiftPM Compatible

analytics-ios is an iOS client for PrimeData.

Special thanks to Tony Xiao, Lee Hasiuk and Cristian Bica for their contributions to the library!

You can't fix what you can't measure

Analytics helps you measure your users, product, and business. It unlocks insights into your app's funnel, core business metrics, and whether you have product-market fit.

How to get started

  1. Collect analytics data from your app(s).
    • The top 200 PrimeData companies collect data from 5+ source types (web, mobile, server, CRM, etc.).
  2. Send the data to analytics tools (for example, Google Analytics, Amplitude, Mixpanel).
    • Over 250+ PrimeData companies send data to eight categories of destinations such as analytics tools, warehouses, email marketing and remarketing systems, session recording, and more.
  3. Explore your data by creating metrics (for example, new signups, retention cohorts, and revenue generation).
    • The best PrimeData companies use retention cohorts to measure product market fit. Netflix has 70% paid retention after 12 months, 30% after 7 years.

PrimeData collects analytics data and allows you to send it to more than 250 apps (such as Google Analytics, Mixpanel, Optimizely, Facebook Ads, Slack, Sentry) just by flipping a switch. You only need one PrimeData code snippet, and you can turn integrations on and off at will, with no additional code. Sign up with PrimeData today.

Why?

  1. Power all your analytics apps with the same data. Instead of writing code to integrate all of your tools individually, send data to PrimeData, once.

  2. Install tracking for the last time. We're the last integration you'll ever need to write. You only need to instrument PrimeData once. Reduce all of your tracking code and advertising tags into a single set of API calls.

  3. Send data from anywhere. Send PrimeData data from any device, and we'll transform and send it on to any tool.

  4. Query your data in SQL. Slice, dice, and analyze your data in detail with PrimeData SQL. We'll transform and load your customer behavioral data directly from your apps into Amazon Redshift, Google BigQuery, or Postgres. Save weeks of engineering time by not having to invent your own data warehouse and ETL pipeline.

    For example, you can capture data on any app:

    analytics.track('Order Completed', { price: 99.84 })

    Then, query the resulting data in SQL:

    select * from app.order_completed
    order by price desc

πŸš€ Startup Program

If you are part of a new startup (<$5M raised, <2 years since founding), we just launched a new startup program for you. You can get a PrimeData Team plan (up to $25,000 value in PrimeData credits) for free up to 2 years β€” apply here!

Installation

Install Analytics using pod command.

CocoaPods

pod 'Analytics', :git => 'https://github.com/primedata-ai/analytics-ios.git'

Quickstart

Import SDK: (Inside the Application Delegate Class)

#import <PrimeData.h>

Initialize SDK: (Initialize SDK inside the - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions )

PDAnalyticsConfiguration *configuration = [PDAnalyticsConfiguration configurationWithWriteKey: <write_key> scopeKey: <scope_key> url: <prime_data_server_url>];
[PDAnalytics setupWithConfiguration:configuration];

Initialize SDK and change session timeout (in minutes, default value is 30 minutes)

PDAnalyticsConfiguration *configuration = [PDAnalyticsConfiguration configurationWithWriteKey: <write_key> scopeKey: <scope_key> url: <prime_data_server_url>];
configuration.sessionTimeout = <integer_number>;
[PDAnalytics setupWithConfiguration:configuration];

Initialize SDK and change session timeout (in minutes, default value is 30 minutes) and change the number of events to send to server (default value is 20 events)

PDAnalyticsConfiguration *configuration = [PDAnalyticsConfiguration configurationWithWriteKey: <write_key> scopeKey: <scope_key> url: <prime_data_server_url>];
configuration.sessionTimeout = <integer_number>;
configuration.flushAt = <integer_number>;
[PDAnalytics setupWithConfiguration:configuration];

Initialize SDK and enable AdSupport (purpose to get advertisingIdentifier)

PDAnalyticsConfiguration *configuration = [PDAnalyticsConfiguration configurationWithWriteKey: <write_key> scopeKey: <scope_key> url: <prime_data_server_url>];
configuration.sessionTimeout = <integer_number>;
configuration.flushAt = <integer_number>;
configuration.adSupportBlock = ^NSString * _Nonnull{
        return [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString];
    };
[PDAnalytics setupWithConfiguration:configuration];

Identify User:

[[PDAnalytics sharedAnalytics] identify: <user_id>];
[[PDAnalytics sharedAnalytics] identify: <user_id> email: <email>];

For examples:

[[PDAnalytics sharedAnalytics] identify:@"abc" email:@"abc@icloud.com"];

Track events:

[[PDAnalytics sharedAnalytics] track: <event_name>];
[[PDAnalytics sharedAnalytics] track: <event_name>  properties: <NSDictionary> source: <NSDictionary>  target: <NSDictionary>];

For examples:

 [[PDAnalytics sharedAnalytics] track:@"category_viewed_test"
                              properties: @{
                                              @"category_id": @"SALE_OFF",
                                              @"category_level": @"50_PERCENT_OFF",
                                              @"category_name": @"BEAT THE CHILL KNITS & JACKETS",
                                              @"category_url_slug": @"JUST_ARRVED_TAB"
                                          }
                                  source:@{
                                              @"itemId": @"ARRVED",
                                              @"itemType": @"ARRVED_TAB"
                                          }
                                  target: @{
                                               @"itemId": @"ARRVED_TAB_ROW",
                                               @"itemType": @"ARRVED_TAB_ROW"
                                           }];
//========================================================================================================
[[PDAnalytics sharedAnalytics] track:@"product_cart_dded_test"
                              properties: @{
                                             @"currency": @"Euro",
                                              @"product_category": [NSString stringWithFormat:@"%d", [productVariant.category intValue]],
                                              @"product_color": productVariant.color.name,
                                              @"product_id": [NSString stringWithFormat:@"%d", [productVariant.product.productID  intValue]],
                                              @"product_name": productVariant.product.name,
                                              @"product_price": [NSString stringWithFormat:@"%d", [productVariant.product.price intValue]]
                                          }
                                  source:@{
                                              @"itemId": @"SALE_OFF",
                                              @"itemType": @"BEAT THE CHILL KNITS & JACKETS"
                                          }
                                  target: @{
                                              @"itemId": productVariant.product.name,
                                              @"itemType": productVariant.product.name
                                           }]; 

Packages

No packages published

Languages

  • Objective-C 94.9%
  • Swift 4.4%
  • Other 0.7%