Facebook Parse: Push Notifications & Analytics

Facebook's acquisition of Parse has given the social giant a big boost in mobile by making it easier for API developers to create apps for the Facebook platform. In this three-part series, we take a closer look at developing with Parse.

  • In the first installment of our series, we explain why this platform makes an excellent minimum viable product (MVP) cloud solution that enables developers to focus on code instead of server infrastructure. We show you how to create a new project on Parse and explore the various dashboard features.
  • In the second part of our series, we integrate Parse into a sample iOS project, explaining the essential concepts of working with Parse objects and relationships.
  • In this, the final part of our series, we work with push notifications using Parse, as well as with Parse Analytics and Crash Reporting as we complete our sample iOS project.


In our first article we covered what Parse is, its benefits and how to set up your account. We even got started on our Parse sample application by populating the Parse database. The second article guided you through integrating Parse into an existing app, including making appropriate changes.

In our final installment, we will learn about Parse push notifications, as well as take a look at Parse Analytics.

Introduction to Push Notifications

Push notifications provide an excellent and rich channel of engagement and interaction with your app’s users, allowing for real-time messaging and information delivery as well as promotions.

Parse Push delivers a simple, convenient and feature-rich method to send intelligent push notifications, segmented according to your marketing campaign needs. While we are focusing solely on iOS, Parse’s Push engine works cross-platform, from iOS to Android and even Windows Phones.


Above: Targeted campaigns, segmented by various channels and user groups in Parse Push.

Composing push notifications is one of the most impressive features of Parse Push. You can use the Web console or client-side SDK or trigger notifications through the Rest API. You can even schedule notifications remotely and place them in queues, to be triggered in symphony with your campaigns.

Other comparable push management tools are available, such as Urban Airship, or you can go completely custom using your own push notification server with Apple

Urban Airship offers quite an elaborate set of engagement products, such as iBeacon targeting and Apple Pay/Google Wallet integration, but what you are getting with Parse Push is an integrated ecosystem leveraging the other areas we covered, such as Push Core and Push Analytics.

Creating your own custom push notification server requires infrastructure investment and time, whereas Parse Push allows for an MVP demonstration right out of the box.

Setting Up Your Parse App

Before you can start working with push notifications, you need to create an SSL certificate, along with a provisioning profile for an app. We won't go into detail on this here, but you can find more information by visiting Apple’s official documentation.

After setting up the SSL certificate and provisioning profile, you need to link the certificate in Parse by going to Settings -> Push. You then enable Push Notifications Settings in the first section, before uploading your recently created SSL certificate in the second section, as shown below:


Sending Push Notifications

After you have followed the instructions to set up your SSL certificates, provisioning profile, there are still a few steps that you need to go through to get the notification system to work. For our example, we are just going to send a simple notification message, but you can create more elaborate ones that are either triggered via cloud-code logic or within the app (such as sending a message to another user). You can also provide deep linking, so that when the user selects the notification, it can take the user to a specific part of your app.

First, in Xcode, go to the AppDelegate and add the following code, right after the other Parse calls:

UIUserNotificationType userNotificationTypes = (UIUserNotificationTypeAlert |
                                                UIUserNotificationTypeBadge |
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:userNotificationTypes
[application registerUserNotificationSettings:settings];
[application registerForRemoteNotifications];

We will also need to add this method somewhere down in the AppDelegate, to register for remote notifications:

- (void)application:(UIApplication *)application
        didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
    // Store the deviceToken in the current Installation and save it to Parse.
    PFInstallation *currentInstallation = [PFInstallation currentInstallation];
    [currentInstallation setDeviceTokenFromData:deviceToken];
    [currentInstallation saveInBackground];

You will need to run the app on your phone (not your simulator) for the first time so that it registers on Parse. Once you’ve given it a quick run, on Parse, go to Push -> Send a new Push message, and you should be presented with a screen similar to this:


For the purpose of this tutorial we are only working with iOS, but you can see that the first option Parse presents is the ability to segment our message by a specific platform or all platforms.

Segmenting on iOS is as easy as creating a PFQuery and associating a push call:

 // Create our Installation query
PFQuery *pushQuery = [PFInstallation query];
[pushQuery whereKey:@"likesCats" equalTo:YES];
// Send push notification to query
PFPush *push = [[PFPush alloc] init];
[push setQuery:pushQuery]; // Set our Installation query
[push setMessage:@“We have a new cat at CatFoster for you to meet”];
[push setChannel:@"catOwners"];
[push sendPushInBackground]; 

A/B Testing

A/B Testing lets you send different messages (or same message at different times) to different groups, to test market reactions to certain campaigns.


Source: Parse.com

Parse Push guides you through the process of segmenting your push notification messages as "experiments" to test audiences, splitting the audience into two groups. Parse randomly assigns devices to each group to minimize the chance of one test affecting another test. 

Once you’ve started an experiment, you can return to it later on and verify which group had more push opens.


Parse also provides recommendations on test audience size, suggesting the minimum size of your test audience, and confidence interval, providing the statistical significance level required to determine that your experiment has enough results for interpolation. Further, Push notification messages can be initiated through the REST API or event-triggered via iOS code, where one user/device needs to notify another user/device.

Consult Parse’s documentation for an extensive guide on other features available within the Parse Push ecosystem.

Parse Analytics


Parse Analytics is Parse’s platform for tracking your app performance. We have also looked at other mobile analytics frameworks, such as Keen IO and Twitter’s Fabric. Each has its pluses and minuses, according to our assessments.

In order to convince your stakeholders of the performance and reception of your app beyond vanity statistics (downloads), you will need a framework that fits well into your marketing workflow. Within the integrated Parse ecosystem, analytics can leverage open rates from your Parse Push marketing initiatives, as well as track Parse API calls when you interact with Parse objects in your code. 

Circling back to the potential startup audience for Parse, informative and lean analytics is the cornerstone of delivering a strong MVP to seed rounds.

Parse Analytics is composed of two tools to aid in managing an app: crash monitoring and app-usage measurement.

Crash Monitoring

Crash monitoring provides users with insight into the number and types of crashes that are happening out in the wild after an app has been distributed. It also helps users to understand which crashes have the biggest impacts, providing stack traces and device information to figure out how to remedy the bugs.

To set up Crash Reporting on an existing app, you need to add one more framework library from the Parse frameworks folder we downloaded:


Back in the AppDelegate class, add the following:

#import <ParseCrashReporting/ParseCrashReporting.h>
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
 [ParseCrashReporting enable];

After enabling ParseCrashReporting in AppDelegate, we set up our project to work with Symbol Files by downloading Parse CLI, which you can do in terminal as follows:

curl -s https://www.parse.com/downloads/cloud_code/installer.sh | sudo /bin/bash

Followed by:

parse new

In your App’s target Build Script Phrase, add the following:

export PATH=/usr/local/bin:$PATH
cd <path_to_cloudcode_folder>


Parse has provided a screen recording that explains how to set this up.

Sending a Crash Report

In our GitHub sample project, we have commented out in the app delegate a method that would intentionally cause a crash. If you uncomment it and run it on your device to simulate a crash, on Parse you would see the following crash information:

As you can see, the simulated crash provides a great deal of information that we can use moving forward. Going to Analytics -> Crashes, we can observe the number of times a specific crash occurs, which helps evaluate and prioritize each bug. 

The stack trace, which we have symbolicated, tells us which class and, more specifically, which method call is the instigator. Looking at the stack trace we just ran above, we see the crash appears in:

-[TheElementsAppDelegate crash] @ 0x18, TheElementsAppDelegate.m : 139

This allows us to go to the AppDelegate, line 139, and run Xcode instruments to further observe what is happening (if it’s less obvious than the one we purposely added to crash).

Working With Analytics

PFAnalytics also can provide more customized, free-form tracking of events, allowing for an even finer-grained segmentation of custom events via the Dashboard.

PFAnalytics makes use of dictionaries, enabling users to pass a key-value pair back to Parse. We will demonstrate this by adding the following code to ElementsTableViewController.m as the last method:

- (void)tellAnalyticsAboutElement:(AtomicElement*) element{
    NSDictionary *dimensions = @{
                                 @"element name": element.name,
                                 @"where": self.description,
                                 @"state": element.state
    // Send the dimensions to Parse along with the 'search' event
    [PFAnalytics trackEvent:@"element" dimensions:dimensions];


Build and run. After a few minutes, in Parse -> Analytics, you can see under Custom Breakdown the custom events that we tracked for our elements:

Custom Analytics allows for arbitrary tracking of events and dimensions, and, as we just saw with our NSDictionary, providing a data structure allows us to create key-value pairs to cater to the precise level of events we are interested in tracking.

 [PFAnalytics trackEvent:@"SignUp" dimensions:@{ @"gender": @"f", @"source": @"mobile" }]; 


We have merely touched the surface of what Parse is capable of, but with a bit of information to guide you in the right direction, you are primed to explore various advanced topics, such as working with Parse Cloud and Cloud Modules. Along with the sample project that we worked on, Parse provides numerous tutorial projects for you to dabble with to get more familiar with Parse — in numerous clients, from iOS to JavaScript and .NET.

Parse is a great platform that enjoys strong support from the development community, under the backing of Facebook. Its development framework is easy to use; its dashboard tools are just as easy; and the platform makes it quick and easy to create cloud storage and provide analytics and push notifications without server infrastructure investment. All of this combined makes Parse a great MVP tool for startups.

Doron Katz A keen passion for emerging technologies, practices and methodologies, Doron embraces the vision of lean development with continuous customer development. Consultant for various startups, as a Project and Product Manager, with a mobile engineering background in iOS, and over 10 years of professional web development experience.