timonus / TJMixpanelLogger

Bare-bones Obj-C Mixpanel logger

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TJMixpanelLogger

TJMixpanelLogger is a bare-bones Objective-C Mixpanel logger. It only provides event logging, not user logging or other features that Mixpanel provides.

Setup & Use

To configure TJMixpanelLogger, set its projectToken to your Mixpanel project's project token.

TJMixpanelLogger.projectToken = @"your-token-here";

If you'd like to use TJMixpanelLogger within app extensions, you should also set its sharedContainerIdentifier property to an app group identifier.

TJMixpanelLogger.sharedContainerIdentifier = @"an-app-group-identifier";

To log an event with TJMixpanelLogger, use the +logEventWithName:properties: method.

[TJMixpanelLogger logEventWithName:@"photo_shared"
                        properties: @{
    @"source": @"camera"
    @"width": ...
}];

Default Event Properties

Events logged using TJMixpanelLogger automatically capture the following info.

  • A base 64 version of identifierForVendor as the install identifier.
  • The app version string.
  • The OS version.
  • The device model.
  • The screen dimensions.
  • Coarse IP-based location.
  • The preferred language.
  • For app extensions, the suffix of the extension is included as bundle_id_suffix. Apps including extensions will have bundle_id_suffix=null for events from the main app.

Other Notes

  • This logger supports app extensions (needed for Opener and Checkie).
  • This logger supports watchOS (needed for Checkie).
  • This logger uses background URL sessions.
  • This is the successor to a custom Google Analytics logger I've been using for a while (very old source snapshot).

About

Bare-bones Obj-C Mixpanel logger

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Objective-C 100.0%