• Stars
    star
    1,834
  • Rank 25,303 (Top 0.5 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created almost 12 years ago
  • Updated about 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Simplify your iOS/Mac analytics

ARAnalytics v4 Build Status

ARAnalytics is to iOS what Analytical is to ruby, or Analytics.js is to javascript.

ARAnalytics is an analytics abstraction library offering a sane API for tracking events and user data. It currently supports on iOS: Mixpanel, Localytics, Flurry, GoogleAnalytics, KISSmetrics, Crittercism, Crashlytics, Fabric, Bugsnag, Countly, Helpshift, Tapstream, NewRelic, Amplitude, HockeyApp, HockeyAppLib, ParseAnalytics, HeapAnalytics, Chartbeat, UMengAnalytics, Librato, Segmentio, Swrve, YandexMobileMetrica, Adjust, AppsFlyer, Branch, Snowplow, Sentry, Intercom, Keen, Adobe and MobileAppTracker/Tune. And for OS X: KISSmetrics, Mixpanel and HockeyApp.

It does this by using CocoaPods subspecs to let you decide which libraries you'd like to use. You are free to also use the official API for any provider too. Also, it comes with an amazing DSL to clear up your methods.

Changelog

Integration

You shouldn't just use: pod "ARAnalytics". Since CocoaPods 0.36+ you should do something like:

  pod "ARAnalytics", :subspecs => ["Mixpanel", "Segmentio", "HockeyApp"]

Usage

Setup

Once you've pod installed'd the libraries you can either use the individual (for example) [ARAnalytics setupTestFlightWithTeamToken:@"TOKEN"] methods to start up each individual analytics platform or use the generic setupWithAnalytics with our constants.

  [ARAnalytics setupWithAnalytics:@{
      ARCrittercismAppID : @"KEY",
      ARKISSMetricsAPIKey : @"KEY",
      ARGoogleAnalyticsID : @"KEY"
   }];

Logging

Submit a console log that is stored online, for crash reporting this provides a great way to provide breadcrumbs. ARLog(@"Looked at Artwork (%@)", _artwork.name);

extern void ARLog (NSString *format, ...);

Event Tracking

/// Submit user events
+ (void)event:(NSString *)event;
+ (void)event:(NSString *)event withProperties:(NSDictionary *)properties;

// Add extra properties to get sent along with every event
+ (void)addEventSuperProperties:(NSDictionary *)superProperties;


/// Let ARAnalytics deal with the timing of an event
+ (void)startTimingEvent:(NSString *)event;
+ (void)finishTimingEvent:(NSString *)event;

Error Tracking

/// Submit errors to providers
+ (void)error:(NSError *)error;
+ (void)error:(NSError *)error withMessage:(NSString *)message;

User Properties

/// Set a per user property
+ (void)identifyUserWithID:(NSString *)userID andEmailAddress:(NSString *)email;
+ (void)setUserProperty:(NSString *)property toValue:(NSString *)value;
+ (void)incrementUserProperty:(NSString*)counterName byInt:(int)amount;

Page View Tracking

/// Monitor Navigation changes as page view
+ (void)pageView:(NSString *)pageTitle;
+ (void)monitorNavigationViewController:(UINavigationController *)controller;

On top of this you get access to use the original SDK. ARAnalytics provides a common API between lots of providers, so it will try to map most of the functionality between providers, but if you're doing complex things, expect to also use your provider's SDK.

Aspect-Oriented DSL

There is also a DSL-like setup constructor in the ARAnalytics/DSL subspec that lets you do all of your analytics setup at once. Example usage:

[ARAnalytics setupWithAnalytics: @{ /* keys */ } configuration: @{
   ARAnalyticsTrackedScreens: @[ @{
      ARAnalyticsClass: UIViewController.class,
      ARAnalyticsDetails: @[ @{
          ARAnalyticsPageNameKeyPath: @"title",
      }]
  }],
   ARAnalyticsTrackedEvents: @[@{
      ARAnalyticsClass: MyViewController.class,
      ARAnalyticsDetails: @[ @{
          ARAnalyticsEventName: @"button pressed",
          ARAnalyticsSelectorName: NSStringFromSelector(@selector(buttonPressed:)),
      },
      @{
          ARAnalyticsEventName: @"switch switched",
          ARAnalyticsSelectorName: NSStringFromSelector(@selector(switchSwitched:)),
      }]
   },
   ...

The above configuration specifies that the "button pressed" event be sent whenever the selector buttonPressed: is invoked on any instance of MyViewController. Additionally, every view controller will send a page view with its title as the page name whenever viewDidAppear: is called. There are also advanced uses using blocks in the DSL to selectively disable certain events, provide custom page/event property dictionaries, or to provide dynamic page/event names.

[ARAnalytics setupWithAnalytics: @{ /* keys */ } configuration: @{
   ARAnalyticsTrackedScreens: @[ @{
      ARAnalyticsClass: UIViewController.class,
      ARAnalyticsDetails: @[ @{
          ARAnalyticsProperties: ^NSDictionary*(MyViewController *controller, NSArray *parameters) {
            return @{ /* Custom screen view properties */ };
          }, 
          ARAnalyticsPageNameBlock:  ^NSDictionary*(MyViewController *controller, NSArray *parameters, NSDictionary *customProperties) {
            return [NSString stringWithFormat:@"%@:%@:%@",controller.a, controller.b, controller.c];
          }
      }]
  }],
  ARAnalyticsTrackedEvents: @[ @{
    ARAnalyticsClass: MyViewController.class,
    ARAnalyticsDetails: @[ 
      @{
        ARAnalyticsSelectorName: NSStringFromSelector(@selector(buttonPressed:)),
        ARAnalyticsShouldFire: ^BOOL(MyViewController *controller, NSArray *parameters) {
          return /* some condition */;
        },
        ARAnalyticsProperties: ^NSDictionary*(MyViewController *controller, NSArray *parameters) {
          return @{ /* Custom properties */ };
        },
        ARAnalyticsEventNameBlock:  ^NSDictionary*(MyViewController *controller, NSArray *parameters, NSDictionary *customProperties) {
          return [NSString stringWithFormat:@"%@ pressed", [(UIButton*)parameters[0] titleLabel].text];
        }
      },
      /* more events for this class */
    ]
  },
  ...

Note that when using page tracking on UIViewControllers, all instances must have a non-nil value for their title property. If your app uses nested view controllers, that may not be the case. In this instance, use the ARAnalyticsShouldFire block to disable these view controllers from firing analytics events.

ARAnalyticsShouldFire: ^BOOL(MyViewController *controller, NSArray *parameters) {
  return controller.title != nil;
},

HockeyApp

Starting with HockeyApp version 3.7.0, the HockeyApp provider will automatically keep logs of events and include those in crash reports, thus adding β€˜breadcrumbs’ to your report and hopefully providing helpful context for your crash reports. Any messages logged with ARLog() will also get included in the report.

Note, however, that on iOS syslogd will not keep logs around for a long time, as such you should only expect logs of people that re-start the application immediately after the application crashing.

Full list of subspecs

iOS: Mixpanel, Localytics, Flurry, GoogleAnalytics, Firebase, KISSmetrics, Crittercism, Countly, Bugsnag, Helpshift, Tapstream, NewRelic, Amplitude, HockeyApp, HockeyAppLib, ParseAnalytics, HeapAnalytics, Chartbeat, UMengAnalytics, Segmentio, Swrve, YandexMobileMetrica, Adjust, Intercom, Librato, Crashlytics, Fabric, AppsFlyer, Branch, Snowplow, Sentry, Keen, Adobe, MobileAppTracker, Leanplum & Appboy.

OSX: KISSmetricsOSX, HockeyAppOSX, MixpanelOSX & ParseAnalyticsOSX.

Contributing, or adding a new analytics provider

See Contributing

More Repositories

1

cocoapods-keys

A key value store for storing per-developer environment and application keys
Ruby
1,551
star
2

GIFs

A Mac App for finding GIFs
Objective-C
602
star
3

pragmatic-testing

Pragmatic testing ebook
Ruby
542
star
4

vscode-twoslash-queries

VS Code extension which adds support for twoslash queries into typescript projects
TypeScript
426
star
5

ORStackView

Vertically stack views using Auto Layout, with an order specific subclass that uses view tags for ordering.
Objective-C
423
star
6

Snapshots

An Xcode Plugin to show the state of FBSnapshot Tests.
Objective-C
363
star
7

typescript-notes

High-level notes about TypeScript
320
star
8

cocoapods-fix-react-native

A CocoaPods plugin for hot-patching React Native per-version
Ruby
243
star
9

You-Can-Do-It

Is learning a new language getting you down? Worry not, this Xcode plugin will keep you motivated.
Objective-C
240
star
10

chairs

Swap around your iOS Simulator Documents
Ruby
227
star
11

vscode-react-native-storybooks

Inline your Storybooks server in VS Code
TypeScript
164
star
12

SpeedS-ver

A Mac OS X Screensaver - Shows people doing speedruns as your screensaver.
Objective-C
146
star
13

iMessage-Style-Receding-Keyboard

A demo application for showing how to drag the keyboard down with your finger.
Objective-C
137
star
14

wwdc_parties_2014

What is happening in WWDC 2014
109
star
15

Wallpapers

A Mac App for Downloading Wallpapers.
Objective-C
92
star
16

RedXcode

When Xcode is being ran in a debugger, make it obvious that it's in dev mode by turning it red and adding a cool banner.
Objective-C
91
star
17

twitter-urls-to-clients

Safari / Chrome extension to convert all Twitter.com urls to mac twitter app specific URLs
JavaScript
87
star
18

Puttio

A Universal iOS App for Put.IO
Objective-C
87
star
19

awesome-typescript-derived-languages

Projects which have taken "TypeScript" and made it more than just 'JS with Types'
85
star
20

recommendations

A source-format agnostic way of providing recommendations
Ruby
82
star
21

dna

my dna in raw text
79
star
22

Essence

A VSCode UI.
CSS
77
star
23

ORSimulatorKeyboardAccessor

Use your keyboard in the iOS simulator with a blocks based API
Objective-C
73
star
24

AppCode

Custom Setup for App Code
66
star
25

Heuristics-for-vendoring-MIT-code

A quick readme covering the cases where you would import code
59
star
26

danger-junit

Lets you report your test suite problems back to the PR elegantly
Ruby
58
star
27

keyboard_shortcuts

Notes on Keyboard Shortcuts for the Mac. Oriented towards technical but not programmers.
53
star
28

TypeScript-TSServer-Plugin-Template

TypeScript
53
star
29

Snapshots-Peek

Show-off your Snapshots in Xcode
Objective-C
52
star
30

vscode-playdate

TypeScript
51
star
31

gh_inspector

A gem that makes it easy to find existing issues for exceptions via GitHub issues
Ruby
49
star
32

WibbleQuest

A Text Adventure Game framework for iOS
Objective-C
46
star
33

OROpenSubtitleDownloader

An Obj-C API for Searching and Downloading Subtitles from OpenSubtitles.
Objective-C
46
star
34

Mixtapes

an iPad app for making mixtapes using Spotify
Objective-C
44
star
35

react-storybooks-relay-container

Storybook template for Relay containers
JavaScript
39
star
36

typescript-stickers

Stickers for TypeScript
39
star
37

youtube

Scripts for videos and talks
39
star
38

GIFKit

A source for GIFs
Objective-C
37
star
39

OROpenInAppCode

Opens the current xcworkspace / xcproject in AppCode.
Objective-C
37
star
40

vscode-ios-common-files

This Extension adds Ruby syntax highlighting for CocoaPods and Fastlane stuff
JavaScript
35
star
41

playground-slides

Make presentations in the TypeScript playground
CSS
35
star
42

travish

Badly emulates the Travis workflow from a .travis.yml
Ruby
34
star
43

danger-plugin-yarn

Provides dependency information on dependency changes in a PR *
TypeScript
30
star
44

Snapshots-app

A Mac App for viewing view-based Snapshot tests
Objective-C
30
star
45

Preferences

Add preferences support for your Xcode plugins.
Objective-C
29
star
46

cocoapods-no-dev-schemes

Removes all the CocoaPods Shared Schemes from Developer Pods
Ruby
27
star
47

relay-redwood-app-example

An example of using Relay in Redwood
TypeScript
27
star
48

OctoDog

A Swift PM module for accessing the GitHub API
Swift
27
star
49

orta

Profile bio
JavaScript
26
star
50

github-webhook-event-types

TypeScript type definitions for GitHub's events
TypeScript
26
star
51

cocoapods-xcautotest

Automatically inject new test classes into your iOS simulator without restarts.
C
26
star
52

danger-plugin-spellcheck

Spell checks any created or modified code or markdown files in a GitHub PR
TypeScript
26
star
53

GotTheRoutesLikeSwagger

Ruby app to take a Swagger API and generate NSURLRequests.
Ruby
25
star
54

cocoapods-always-be-bundleing

A CocoaPods Plugin that stops
Ruby
25
star
55

nightly-profile-updater

HTML
25
star
56

ar_dispatch

Dispatch functions run async code synchronous in tests
Objective-C
25
star
57

cocoapods-expert-difficulty

Make your CocoaPods experience even harder, by ignoring platforms from lib authors
Ruby
24
star
58

PonyDebuggerApp

A host app for Pony Debugger
Objective-C
24
star
59

danger-plugin-lighthouse

Print your Lighthouse reports to your PR
HTML
22
star
60

typescript-web-extension

A cross-browser extension for working with TypeScript code
JavaScript
22
star
61

github-clippers

Automate away the annoying requests for you to close your branches after PR merges in Safari
JavaScript
22
star
62

Relay-Artist-Example

An example React Native app using Relay to access the Artsy GraphQL API
Objective-C
22
star
63

FUSEHub

A MacFUSE filesystem for browsing a github repository
Objective-C
21
star
64

playground-collaborate

Collaborate in the TypeScript Playground
TypeScript
21
star
65

ImageCachingExamples

A complete example of using SDWebImage to do synchronous image loading for FBSnapshots
Swift
18
star
66

github-activity-writer

TypeScript
18
star
67

GitDawg

React Native Components for GitHawk
Ruby
17
star
68

Tinker

A Text Adventure Game Framework for Swift
Swift
17
star
69

pull-lock

Run commands based on changes during a git pull
TypeScript
17
star
70

playground-transformer-timeline

Lets you see each stage of the transform process for a TypeScript JS + DTS emit as a timeline.
TypeScript
16
star
71

FastImageCacheExample

The simplest possible use of FastImageCache
Objective-C
16
star
72

gh-commentify

A repo you can use to work-around GH issue comment request limits
TypeScript
15
star
73

vscode-themes

vscode-themes
JavaScript
15
star
74

playground-clippy

JavaScript
15
star
75

vigilant

Glues Quick & Nimble together. Makes sure you run an expectation on every test.
Objective-C
15
star
76

redwood-object-identification

TypeScript
14
star
77

md-type-tables

JavaScript
14
star
78

mogenerator-template

A mogenerator template that generates more human-readable _Class files
14
star
79

react-native-45-typescript-example

An example of taking react-native's default template and making it work with typescript
JavaScript
14
star
80

systems-theory

React Native in TypeScript that feels good
JavaScript
13
star
81

notes

An exploration on keeping public notes
CSS
13
star
82

playground-typescript-json-schema

TypeScript
13
star
83

nakama-typescript-example

An example of a nakama server using 2022's bleeding edge TypeScript tooling
JavaScript
13
star
84

Arena-for-Safari

Adds an are.na button to Safari
JavaScript
13
star
85

video-notes

notes for video editing
12
star
86

snazzy

A Snazzy README generator for your public API built on SourceKitten
Ruby
12
star
87

playground-plugin-tsquery

Run TSQuery in the TypeScript Playground
TypeScript
12
star
88

orta.github.com

orta blog
JavaScript
12
star
89

markdown-magic-inline-types

Inline TypeScript types into markdown files
JavaScript
12
star
90

snake-in-typescript

Lua
11
star
91

redwood-codegen-api-types

Replacement types generator for your Redwood API
TypeScript
11
star
92

omakase-create-react-app-example

Using CRA 2.1 to re-create a chunk the the omakase stack
JavaScript
11
star
93

windows-notes

Things to think about in switching from macOS to Windows
11
star
94

snowpack-plugin-hmr-phaser

JavaScript
11
star
95

cocoapods_generate_unit_tests

An experiment in scripting an entirely runnable xcodeproject + tests in ruby
Ruby
10
star
96

life

General issue tracker for things that I should get around to doing
10
star
97

ts-playgrounds-github

Quickly go from a TS code sample to the TypeScript playground
Objective-C
10
star
98

playground-ts-scanner

TypeScript
10
star
99

vscode-typescript-playground-links

An extension which improves working with the TypeScript playground
TypeScript
10
star
100

Steps

A iPhone 5S -> Fitbit app
Objective-C
10
star