Request a Demo Start Trial
These docs are for an old version of DeskMetrics!
Go to the latest docs
Mac Analytics
Download Mac Analytics SDK
version 2.1.0

Package Installers

Introduction

This document will walk you through integrating the DeskMetrics Analytics SDK into the package installer for your application. A complete integration can be seen in the HelloDeskMetricsObjC example.

We’ll make use of the following script template from the SDK zip:

Include or call the script

If your package installer does not yet have a postinstall script, then you can simply use the DeskMetrics postinstall script directly. Copy postinstall to a scripts folder (or similar) in your project and reference it when you run pkgbuild using the --scripts argument.

If your package installer already has a postinstall script, then you’ll need include the DeskMetrics script with your application as a resource, and run it from your existing postinstall script.

Customize the script

Once you’re satisfied that the DeskMetrics postinstall script is being invoked (either directly by the package installer or by your custom postinstall script), you’ll need to customize some variables. Look for the following snippet and update the values so they make sense for your project.

# Set these appropriately for your project
APP_KEY = u'<YOUR_APP_KEY_HERE>'
TRACKING_ID = u'<YOUR_TRACKING_ID_HERE>'
SUB_ID = u'<YOUR_SUB_ID_HERE>'
CHANNEL = u'<YOUR_CHANNEL_HERE>'

# Subdirectory of "/Library/Application Support" where DeskMetrics data will be persisted.  Use your
# own application name as the subfolder name.
DATA_DIR = u'%s/HelloDeskMetricsObjC' % APP_SUPPORT_PATH

# Full path to the DeskMetrics framework distributed with your application
DYLIB_PATH = u'%s/HelloDeskMetricsObjC.app/Contents/Frameworks/DeskMetricsAnalytics.framework/DeskMetricsAnalytics' % INSTALL_PATH