This Sample app guide walks you through the steps of logging Flurry standardized event into your iOS app.
Like a custom event, a standard event also has a two-level structure. The highest level is the specific action, in this case the purchasing of an item. For this example, we are using the SDK standardized event name FLURRY_EVENT_PURCHASED
.
In Flurry+Event.h, Flurry iOS SDK defines 58 standardized event names, and they are categorized in advertising, gaming, content, commerce, membership, onboarding, registration, search, social, media, and privacy.
The second level in the standard event structure is the event parameter, which will be an instance of SDK defined Interface - FlurryParamBuilder. In order for SDK to log a standard event, you might want to put the standardized parameters as well as your own defined parameters together. There will be recommended standardized parameter keys and mandatory standardized parameter keys defined for each standard event name. For instance, to log FLURRY_EVENT_PURCHASED event name, SDK suggests to include itemCount, totalAmount, itemId, success, itemName, itemType, currencyType and transactionId parameters, in which totalAmount is also a mandatory parameter that is indicated by the SDK. There are more than 40 standardized parameter keys that come from 5 interfaces (FlurryStringParam, FlurryDoubleParam, FlurryBooleanParam, FlurryIntegerParam, FlurryLongParam). Each type of standardized parameter key can only be mapped to its corresponding data value - string, integer, double, boolean, long. So when you assemble your FlurryParamBuilder object with the standardized parameters, you will need to use the public APIs specified in FlurryParamBuilder interface to map them correctly.
If you already have a Flurry project for Analytics or Ads, you may skip these steps.
Set up your project using the instructions provided in Integrate Flurry SDK for iOS.
- Create an App and Get Your API Key.
- Add the following dependency to your app's CocoaPod, then do
pod install
.
pod 'Flurry-iOS-SDK/FlurrySDK' #Analytics Pod
pod 'Flurry-iOS-SDK/FlurryAds' #Advertising Pod (requires Analytics)
- Initialize the Flurry SDK with your project’s API key.
[Flurry startSession:YOUR_FLURRY_API_KEY];
- Initialize Flurry SDK
[Flurry startSession:YOUR_FLURRY_API_KEY];
- Create the FlurryParamBuilder instance (example)
FlurryParamBuilder *param = [[[[[[FlurryParamBuilder alloc] init]
setString:@"Game pro" forParam:[FlurryParamBuilder levelName]]
setInteger:2 forParam:[FlurryParamBuilder levelNumber]]
setString:@"12345" forKey:@"userId"]
setInteger:10 forKey:@"numOfTrials"];
- Log the event
[Flurry logStandardEvent:FLURRY_EVENT_LEVEL_COMPLETED withParameters:param];
Copyright 2021 Oath Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.