TJMixpanelLogger
is a bare-bones Objective-C Mixpanel logger. It only provides event logging, not user logging or other features that Mixpanel provides.
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": ...
}];
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 havebundle_id_suffix=null
for events from the main app.
- 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).