commit | author | age
|
2e29a3
|
1 |
/* |
L |
2 |
* Copyright (c) Meta Platforms, Inc. and affiliates. |
|
3 |
* All rights reserved. |
|
4 |
* |
|
5 |
* This source code is licensed under the license found in the |
|
6 |
* LICENSE file in the root directory of this source tree. |
|
7 |
*/ |
|
8 |
|
|
9 |
#import <Foundation/Foundation.h> |
|
10 |
|
|
11 |
#if !TARGET_OS_TV |
|
12 |
#import <WebKit/WebKit.h> |
|
13 |
#endif |
|
14 |
|
|
15 |
#import <FBSDKCoreKit/FBSDKAppEventName.h> |
|
16 |
#import <FBSDKCoreKit/FBSDKAppEventParameterName.h> |
e0ec42
|
17 |
#import <FBSDKCoreKit/FBSDKAppEventsConfiguring.h> |
2e29a3
|
18 |
#import <FBSDKCoreKit/FBSDKAppEventsFlushBehavior.h> |
e0ec42
|
19 |
#import <FBSDKCoreKit/FBSDKAppEventUserDataType.h> |
L |
20 |
#import <FBSDKCoreKit/FBSDKApplicationActivating.h> |
|
21 |
#import <FBSDKCoreKit/FBSDKApplicationLifecycleObserving.h> |
|
22 |
#import <FBSDKCoreKit/FBSDKApplicationStateSetting.h> |
|
23 |
#import <FBSDKCoreKit/FBSDKEventLogging.h> |
2e29a3
|
24 |
#import <FBSDKCoreKit/FBSDKGraphRequest.h> |
L |
25 |
#import <FBSDKCoreKit/FBSDKGraphRequestConnection.h> |
|
26 |
#import <FBSDKCoreKit/FBSDKProductAvailability.h> |
|
27 |
#import <FBSDKCoreKit/FBSDKProductCondition.h> |
e0ec42
|
28 |
#import <FBSDKCoreKit/FBSDKSourceApplicationTracking.h> |
L |
29 |
#import <FBSDKCoreKit/FBSDKUserIDProviding.h> |
2e29a3
|
30 |
|
L |
31 |
NS_ASSUME_NONNULL_BEGIN |
|
32 |
|
|
33 |
@class FBSDKAccessToken; |
|
34 |
|
e0ec42
|
35 |
/// Optional plist key ("FacebookLoggingOverrideAppID") for setting `loggingOverrideAppID` |
2e29a3
|
36 |
FOUNDATION_EXPORT NSString *const FBSDKAppEventsOverrideAppIDBundleKey |
L |
37 |
NS_SWIFT_NAME(AppEventsOverrideAppIDBundleKey); |
|
38 |
|
|
39 |
/** |
e0ec42
|
40 |
Client-side event logging for specialized application analytics available through Facebook App Insights |
2e29a3
|
41 |
and for use with Facebook Ads conversion tracking and optimization. |
L |
42 |
|
|
43 |
The `FBSDKAppEvents` static class has a few related roles: |
|
44 |
|
|
45 |
+ Logging predefined and application-defined events to Facebook App Insights with a |
|
46 |
numeric value to sum across a large number of events, and an optional set of key/value |
|
47 |
parameters that define "segments" for this event (e.g., 'purchaserStatus' : 'frequent', or |
|
48 |
'gamerLevel' : 'intermediate') |
|
49 |
|
|
50 |
+ Logging events to later be used for ads optimization around lifetime value. |
|
51 |
|
|
52 |
+ Methods that control the way in which events are flushed out to the Facebook servers. |
|
53 |
|
|
54 |
Here are some important characteristics of the logging mechanism provided by `FBSDKAppEvents`: |
|
55 |
|
|
56 |
+ Events are not sent immediately when logged. They're cached and flushed out to the Facebook servers |
|
57 |
in a number of situations: |
|
58 |
- when an event count threshold is passed (currently 100 logged events). |
|
59 |
- when a time threshold is passed (currently 15 seconds). |
|
60 |
- when an app has gone to background and is then brought back to the foreground. |
|
61 |
|
|
62 |
+ Events will be accumulated when the app is in a disconnected state, and sent when the connection is |
|
63 |
restored and one of the above 'flush' conditions are met. |
|
64 |
|
|
65 |
+ The `FBSDKAppEvents` class is thread-safe in that events may be logged from any of the app's threads. |
|
66 |
|
|
67 |
+ The developer can set the `flushBehavior` on `FBSDKAppEvents` to force the flushing of events to only |
|
68 |
occur on an explicit call to the `flush` method. |
|
69 |
|
|
70 |
+ The developer can turn on console debug output for event logging and flushing to the server by using |
|
71 |
the `FBSDKLoggingBehaviorAppEvents` value in `[FBSettings setLoggingBehavior:]`. |
|
72 |
|
|
73 |
Some things to note when logging events: |
|
74 |
|
|
75 |
+ There is a limit on the number of unique event names an app can use, on the order of 1000. |
|
76 |
+ There is a limit to the number of unique parameter names in the provided parameters that can |
|
77 |
be used per event, on the order of 25. This is not just for an individual call, but for all |
|
78 |
invocations for that eventName. |
|
79 |
+ Event names and parameter names (the keys in the NSDictionary) must be between 2 and 40 characters, and |
|
80 |
must consist of alphanumeric characters, _, -, or spaces. |
|
81 |
+ The length of each parameter value can be no more than on the order of 100 characters. |
|
82 |
*/ |
|
83 |
NS_SWIFT_NAME(AppEvents) |
e0ec42
|
84 |
@interface FBSDKAppEvents : NSObject < |
L |
85 |
FBSDKEventLogging, |
|
86 |
FBSDKAppEventsConfiguring, |
|
87 |
FBSDKApplicationActivating, |
|
88 |
FBSDKApplicationLifecycleObserving, |
|
89 |
FBSDKApplicationStateSetting, |
|
90 |
FBSDKSourceApplicationTracking, |
|
91 |
FBSDKUserIDProviding |
|
92 |
> |
2e29a3
|
93 |
|
L |
94 |
- (instancetype)init NS_UNAVAILABLE; |
|
95 |
+ (instancetype)new NS_UNAVAILABLE; |
|
96 |
|
e0ec42
|
97 |
/// The shared instance of AppEvents. |
2e29a3
|
98 |
@property (class, nonatomic, readonly, strong) FBSDKAppEvents *shared; |
L |
99 |
|
e0ec42
|
100 |
/// Control over event batching/flushing |
2e29a3
|
101 |
|
L |
102 |
/// The current event flushing behavior specifying when events are sent back to Facebook servers. |
|
103 |
@property (nonatomic) FBSDKAppEventsFlushBehavior flushBehavior; |
|
104 |
|
|
105 |
/** |
|
106 |
Set the 'override' App ID for App Event logging. |
|
107 |
|
|
108 |
In some cases, apps want to use one Facebook App ID for login and social presence and another |
|
109 |
for App Event logging. (An example is if multiple apps from the same company share an app ID for login, but |
|
110 |
want distinct logging.) By default, this value is `nil`, and defers to the `FBSDKAppEventsOverrideAppIDBundleKey` |
|
111 |
plist value. If that's not set, it defaults to `Settings.shared.appID`. |
|
112 |
|
|
113 |
This should be set before any other calls are made to `AppEvents`. Thus, you should set it in your application |
|
114 |
delegate's `application(_:didFinishLaunchingWithOptions:)` method. |
|
115 |
*/ |
|
116 |
@property (nullable, nonatomic, copy) NSString *loggingOverrideAppID; |
|
117 |
|
|
118 |
/** |
|
119 |
The custom user ID to associate with all app events. |
|
120 |
|
|
121 |
The userID is persisted until it is cleared by passing `nil`. |
|
122 |
*/ |
|
123 |
@property (nullable, nonatomic, copy) NSString *userID; |
|
124 |
|
|
125 |
/// Returns generated anonymous id that persisted with current install of the app |
|
126 |
@property (nonatomic, readonly) NSString *anonymousID; |
|
127 |
|
|
128 |
/* |
|
129 |
* Basic event logging |
|
130 |
*/ |
|
131 |
|
|
132 |
/** |
|
133 |
Log an event with just an event name. |
|
134 |
|
|
135 |
@param eventName The name of the event to record. Limitations on number of events and name length |
|
136 |
are given in the `AppEvents` documentation. |
|
137 |
*/ |
|
138 |
- (void)logEvent:(FBSDKAppEventName)eventName; |
|
139 |
|
|
140 |
/** |
|
141 |
Log an event with an event name and a numeric value to be aggregated with other events of this name. |
|
142 |
|
|
143 |
@param eventName The name of the event to record. Limitations on number of events and name length |
|
144 |
are given in the `AppEvents` documentation. Common event names are provided in `AppEvents.Name` constants. |
|
145 |
|
|
146 |
@param valueToSum Amount to be aggregated into all events of this event name, and App Insights will report |
|
147 |
the cumulative and average value of this amount. |
|
148 |
*/ |
|
149 |
- (void)logEvent:(FBSDKAppEventName)eventName |
|
150 |
valueToSum:(double)valueToSum; |
|
151 |
|
|
152 |
/** |
|
153 |
Log an event with an event name and a set of key/value pairs in the parameters dictionary. |
|
154 |
Parameter limitations are described above. |
|
155 |
|
|
156 |
@param eventName The name of the event to record. Limitations on number of events and name construction |
|
157 |
are given in the `AppEvents` documentation. Common event names are provided in `AppEvents.Name` constants. |
|
158 |
|
|
159 |
@param parameters Arbitrary parameter dictionary of characteristics. The keys to this dictionary must |
|
160 |
be `NSString`s, and the values are expected to be `NSString` or `NSNumber`. Limitations on the number of |
|
161 |
parameters and name construction are given in the `AppEvents` documentation. Commonly used parameter names |
|
162 |
are provided in `AppEvents.ParameterName` constants. |
|
163 |
*/ |
|
164 |
- (void)logEvent:(FBSDKAppEventName)eventName |
|
165 |
parameters:(nullable NSDictionary<FBSDKAppEventParameterName, id> *)parameters; |
|
166 |
|
|
167 |
/** |
|
168 |
Log an event with an event name, a numeric value to be aggregated with other events of this name, |
|
169 |
and a set of key/value pairs in the parameters dictionary. |
|
170 |
|
|
171 |
@param eventName The name of the event to record. Limitations on number of events and name construction |
|
172 |
are given in the `AppEvents` documentation. Common event names are provided in `AppEvents.Name` constants. |
|
173 |
|
|
174 |
@param valueToSum Amount to be aggregated into all events of this event name, and App Insights will report |
|
175 |
the cumulative and average value of this amount. |
|
176 |
|
|
177 |
@param parameters Arbitrary parameter dictionary of characteristics. The keys to this dictionary must |
|
178 |
be `NSString`s, and the values are expected to be `NSString` or `NSNumber`. Limitations on the number of |
|
179 |
parameters and name construction are given in the `AppEvents` documentation. Commonly used parameter names |
|
180 |
are provided in `AppEvents.ParameterName` constants. |
|
181 |
*/ |
|
182 |
- (void)logEvent:(FBSDKAppEventName)eventName |
|
183 |
valueToSum:(double)valueToSum |
|
184 |
parameters:(nullable NSDictionary<FBSDKAppEventParameterName, id> *)parameters; |
|
185 |
|
|
186 |
/** |
|
187 |
Log an event with an event name, a numeric value to be aggregated with other events of this name, |
|
188 |
and a set of key/value pairs in the parameters dictionary. |
|
189 |
|
|
190 |
@param eventName The name of the event to record. Limitations on number of events and name construction |
|
191 |
are given in the `AppEvents` documentation. Common event names are provided in `AppEvents.Name` constants. |
|
192 |
|
|
193 |
@param valueToSum Amount to be aggregated into all events of this eventName, and App Insights will report |
|
194 |
the cumulative and average value of this amount. Note that this is an `NSNumber`, and a value of `nil` denotes |
|
195 |
that this event doesn't have a value associated with it for summation. |
|
196 |
|
|
197 |
@param parameters Arbitrary parameter dictionary of characteristics. The keys to this dictionary must |
|
198 |
be `NSString`s, and the values are expected to be `NSString` or `NSNumber`. Limitations on the number of |
|
199 |
parameters and name construction are given in the `AppEvents` documentation. Commonly used parameter names |
|
200 |
are provided in `AppEvents.ParameterName` constants. |
|
201 |
|
|
202 |
@param accessToken The optional access token to log the event as. |
|
203 |
*/ |
|
204 |
- (void)logEvent:(FBSDKAppEventName)eventName |
|
205 |
valueToSum:(nullable NSNumber *)valueToSum |
|
206 |
parameters:(nullable NSDictionary<FBSDKAppEventParameterName, id> *)parameters |
|
207 |
accessToken:(nullable FBSDKAccessToken *)accessToken; |
|
208 |
|
|
209 |
/* |
|
210 |
* Purchase logging |
|
211 |
*/ |
|
212 |
|
|
213 |
/** |
|
214 |
Log a purchase of the specified amount, in the specified currency. |
|
215 |
|
|
216 |
@param purchaseAmount Purchase amount to be logged, as expressed in the specified currency. This value |
|
217 |
will be rounded to the thousandths place (e.g., 12.34567 becomes 12.346). |
|
218 |
|
|
219 |
@param currency Currency string (e.g., "USD", "EUR", "GBP"); see ISO-4217 for |
|
220 |
specific values. One reference for these is <http://en.wikipedia.org/wiki/ISO_4217>. |
|
221 |
|
|
222 |
This event immediately triggers a flush of the `AppEvents` event queue, unless the `flushBehavior` is set |
|
223 |
to `FBSDKAppEventsFlushBehaviorExplicitOnly`. |
|
224 |
*/ |
|
225 |
// UNCRUSTIFY_FORMAT_OFF |
|
226 |
- (void)logPurchase:(double)purchaseAmount currency:(NSString *)currency |
|
227 |
NS_SWIFT_NAME(logPurchase(amount:currency:)); |
|
228 |
// UNCRUSTIFY_FORMAT_ON |
|
229 |
|
|
230 |
/** |
|
231 |
Log a purchase of the specified amount, in the specified currency, also providing a set of |
|
232 |
additional characteristics describing the purchase. |
|
233 |
|
|
234 |
@param purchaseAmount Purchase amount to be logged, as expressed in the specified currency.This value |
|
235 |
will be rounded to the thousandths place (e.g., 12.34567 becomes 12.346). |
|
236 |
|
|
237 |
@param currency Currency string (e.g., "USD", "EUR", "GBP"); see ISO-4217 for |
|
238 |
specific values. One reference for these is <http://en.wikipedia.org/wiki/ISO_4217>. |
|
239 |
|
|
240 |
@param parameters Arbitrary parameter dictionary of characteristics. The keys to this dictionary must |
|
241 |
be `NSString`s, and the values are expected to be `NSString` or `NSNumber`. Limitations on the number of |
|
242 |
parameters and name construction are given in the `AppEvents` documentation. Commonly used parameter names |
|
243 |
are provided in `AppEvents.ParameterName` constants. |
|
244 |
|
|
245 |
This event immediately triggers a flush of the `AppEvents` event queue, unless the `flushBehavior` is set |
|
246 |
to `FBSDKAppEventsFlushBehaviorExplicitOnly`. |
|
247 |
*/ |
|
248 |
// UNCRUSTIFY_FORMAT_OFF |
|
249 |
- (void)logPurchase:(double)purchaseAmount |
|
250 |
currency:(NSString *)currency |
e0ec42
|
251 |
parameters:(nullable NSDictionary<FBSDKAppEventParameterName, id> *)parameters |
2e29a3
|
252 |
NS_SWIFT_NAME(logPurchase(amount:currency:parameters:)); |
L |
253 |
// UNCRUSTIFY_FORMAT_ON |
|
254 |
|
|
255 |
/** |
|
256 |
Log a purchase of the specified amount, in the specified currency, also providing a set of |
|
257 |
additional characteristics describing the purchase. |
|
258 |
|
|
259 |
@param purchaseAmount Purchase amount to be logged, as expressed in the specified currency.This value |
|
260 |
will be rounded to the thousandths place (e.g., 12.34567 becomes 12.346). |
|
261 |
|
|
262 |
@param currency Currency string (e.g., "USD", "EUR", "GBP"); see ISO-4217 for |
|
263 |
specific values. One reference for these is <http://en.wikipedia.org/wiki/ISO_4217>. |
|
264 |
|
|
265 |
@param parameters Arbitrary parameter dictionary of characteristics. The keys to this dictionary must |
|
266 |
be `NSString`s, and the values are expected to be `NSString` or `NSNumber`. Limitations on the number of |
|
267 |
parameters and name construction are given in the `AppEvents` documentation. Commonly used parameter names |
|
268 |
are provided in `AppEvents.ParameterName` constants. |
|
269 |
|
|
270 |
@param accessToken The optional access token to log the event as. |
|
271 |
|
|
272 |
This event immediately triggers a flush of the `AppEvents` event queue, unless the `flushBehavior` is set |
|
273 |
to `FBSDKAppEventsFlushBehaviorExplicitOnly`. |
|
274 |
*/ |
|
275 |
// UNCRUSTIFY_FORMAT_OFF |
|
276 |
- (void)logPurchase:(double)purchaseAmount |
|
277 |
currency:(NSString *)currency |
e0ec42
|
278 |
parameters:(nullable NSDictionary<FBSDKAppEventParameterName, id> *)parameters |
2e29a3
|
279 |
accessToken:(nullable FBSDKAccessToken *)accessToken |
L |
280 |
NS_SWIFT_NAME(logPurchase(amount:currency:parameters:accessToken:)); |
|
281 |
// UNCRUSTIFY_FORMAT_ON |
|
282 |
|
|
283 |
/* |
|
284 |
* Push Notifications Logging |
|
285 |
*/ |
|
286 |
|
|
287 |
/** |
|
288 |
Log an app event that tracks that the application was open via Push Notification. |
|
289 |
|
|
290 |
@param payload Notification payload received via `UIApplicationDelegate`. |
|
291 |
*/ |
|
292 |
// UNCRUSTIFY_FORMAT_OFF |
|
293 |
- (void)logPushNotificationOpen:(NSDictionary<NSString *, id> *)payload |
|
294 |
NS_SWIFT_NAME(logPushNotificationOpen(payload:)); |
|
295 |
// UNCRUSTIFY_FORMAT_ON |
|
296 |
|
|
297 |
/** |
|
298 |
Log an app event that tracks that a custom action was taken from a push notification. |
|
299 |
|
|
300 |
@param payload Notification payload received via `UIApplicationDelegate`. |
|
301 |
@param action Name of the action that was taken. |
|
302 |
*/ |
|
303 |
// UNCRUSTIFY_FORMAT_OFF |
|
304 |
- (void)logPushNotificationOpen:(NSDictionary<NSString *, id> *)payload action:(NSString *)action |
|
305 |
NS_SWIFT_NAME(logPushNotificationOpen(payload:action:)); |
|
306 |
// UNCRUSTIFY_FORMAT_ON |
|
307 |
|
|
308 |
/** |
|
309 |
Uploads product catalog product item as an app event |
|
310 |
|
|
311 |
@param itemID Unique ID for the item. Can be a variant for a product. |
|
312 |
Max size is 100. |
|
313 |
@param availability If item is in stock. Accepted values are: |
|
314 |
in stock - Item ships immediately |
|
315 |
out of stock - No plan to restock |
|
316 |
preorder - Available in future |
|
317 |
available for order - Ships in 1-2 weeks |
|
318 |
discontinued - Discontinued |
|
319 |
@param condition Product condition: new, refurbished or used. |
|
320 |
@param description Short text describing product. Max size is 5000. |
|
321 |
@param imageLink Link to item image used in ad. |
|
322 |
@param link Link to merchant's site where someone can buy the item. |
|
323 |
@param title Title of item. |
|
324 |
@param priceAmount Amount of purchase, in the currency specified by the 'currency' |
|
325 |
parameter. This value will be rounded to the thousandths place |
|
326 |
(e.g., 12.34567 becomes 12.346). |
|
327 |
@param currency Currency string (e.g., "USD", "EUR", "GBP"); see ISO-4217 for |
|
328 |
specific values. One reference for these is <http://en.wikipedia.org/wiki/ISO_4217>. |
|
329 |
@param gtin Global Trade Item Number including UPC, EAN, JAN and ISBN |
|
330 |
@param mpn Unique manufacture ID for product |
|
331 |
@param brand Name of the brand |
|
332 |
Note: Either gtin, mpn or brand is required. |
|
333 |
@param parameters Optional fields for deep link specification. |
|
334 |
*/ |
|
335 |
// UNCRUSTIFY_FORMAT_OFF |
|
336 |
- (void)logProductItem:(NSString *)itemID |
|
337 |
availability:(FBSDKProductAvailability)availability |
|
338 |
condition:(FBSDKProductCondition)condition |
|
339 |
description:(NSString *)description |
|
340 |
imageLink:(NSString *)imageLink |
|
341 |
link:(NSString *)link |
|
342 |
title:(NSString *)title |
|
343 |
priceAmount:(double)priceAmount |
|
344 |
currency:(NSString *)currency |
|
345 |
gtin:(nullable NSString *)gtin |
|
346 |
mpn:(nullable NSString *)mpn |
|
347 |
brand:(nullable NSString *)brand |
|
348 |
parameters:(nullable NSDictionary<NSString *, id> *)parameters |
|
349 |
NS_SWIFT_NAME(logProductItem(id:availability:condition:description:imageLink:link:title:priceAmount:currency:gtin:mpn:brand:parameters:)); |
|
350 |
// UNCRUSTIFY_FORMAT_ON |
|
351 |
|
|
352 |
/** |
e0ec42
|
353 |
Notifies the events system that the app has launched and, when appropriate, logs an "activated app" event. |
2e29a3
|
354 |
This function is called automatically from FBSDKApplicationDelegate applicationDidBecomeActive, unless |
L |
355 |
one overrides 'FacebookAutoLogAppEventsEnabled' key to false in the project info plist file. |
|
356 |
In case 'FacebookAutoLogAppEventsEnabled' is set to false, then it should typically be placed in the |
|
357 |
app delegates' `applicationDidBecomeActive:` method. |
|
358 |
|
|
359 |
This method also takes care of logging the event indicating the first time this app has been launched, which, among other things, is used to |
|
360 |
track user acquisition and app install ads conversions. |
|
361 |
|
|
362 |
`activateApp` will not log an event on every app launch, since launches happen every time the app is backgrounded and then foregrounded. |
|
363 |
"activated app" events will be logged when the app has not been active for more than 60 seconds. This method also causes a "deactivated app" |
|
364 |
event to be logged when sessions are "completed", and these events are logged with the session length, with an indication of how much |
|
365 |
time has elapsed between sessions, and with the number of background/foreground interruptions that session had. This data |
|
366 |
is all visible in your app's App Events Insights. |
|
367 |
*/ |
|
368 |
- (void)activateApp; |
|
369 |
|
|
370 |
/* |
|
371 |
* Push Notifications Registration and Uninstall Tracking |
|
372 |
*/ |
|
373 |
|
|
374 |
/** |
|
375 |
Sets and sends device token to register the current application for push notifications. |
|
376 |
|
|
377 |
Sets and sends a device token from the `Data` representation that you get from |
|
378 |
`UIApplicationDelegate.application(_:didRegisterForRemoteNotificationsWithDeviceToken:)`. |
|
379 |
|
|
380 |
@param deviceToken Device token data. |
|
381 |
*/ |
|
382 |
- (void)setPushNotificationsDeviceToken:(nullable NSData *)deviceToken; |
|
383 |
|
|
384 |
/** |
|
385 |
Sets and sends device token string to register the current application for push notifications. |
|
386 |
|
|
387 |
Sets and sends a device token string |
|
388 |
|
|
389 |
@param deviceTokenString Device token string. |
|
390 |
*/ |
|
391 |
// UNCRUSTIFY_FORMAT_OFF |
|
392 |
- (void)setPushNotificationsDeviceTokenString:(nullable NSString *)deviceTokenString |
|
393 |
NS_SWIFT_NAME(setPushNotificationsDeviceToken(_:)); |
|
394 |
// UNCRUSTIFY_FORMAT_ON |
|
395 |
|
|
396 |
/** |
|
397 |
Explicitly kick off flushing of events to Facebook. This is an asynchronous method, but it does initiate an immediate |
|
398 |
kick off. Server failures will be reported through the NotificationCenter with notification ID `FBSDKAppEventsLoggingResultNotification`. |
|
399 |
*/ |
|
400 |
- (void)flush; |
|
401 |
|
|
402 |
/** |
|
403 |
Creates a request representing the Graph API call to retrieve a Custom Audience "third party ID" for the app's Facebook user. |
|
404 |
Callers will send this ID back to their own servers, collect up a set to create a Facebook Custom Audience with, |
|
405 |
and then use the resultant Custom Audience to target ads. |
|
406 |
|
|
407 |
The JSON in the request's response will include a "custom_audience_third_party_id" key/value pair with the value being the ID retrieved. |
|
408 |
This ID is an encrypted encoding of the Facebook user's ID and the invoking Facebook app ID. |
|
409 |
Multiple calls with the same user will return different IDs, thus these IDs cannot be used to correlate behavior |
|
410 |
across devices or applications, and are only meaningful when sent back to Facebook for creating Custom Audiences. |
|
411 |
|
|
412 |
The ID retrieved represents the Facebook user identified in the following way: if the specified access token is valid, |
|
413 |
the ID will represent the user associated with that token; otherwise the ID will represent the user logged into the |
|
414 |
native Facebook app on the device. If there is no native Facebook app, no one is logged into it, or the user has opted out |
|
415 |
at the iOS level from ad tracking, then a `nil` ID will be returned. |
|
416 |
|
|
417 |
This method returns `nil` if either the user has opted-out (via iOS) from Ad Tracking, the app itself has limited event usage |
|
418 |
via the `Settings.shared.isEventDataUsageLimited` flag, or a specific Facebook user cannot be identified. |
|
419 |
|
|
420 |
@param accessToken The access token to use to establish the user's identity for users logged into Facebook through this app. |
|
421 |
If `nil`, then `AccessToken.current` is used. |
|
422 |
*/ |
|
423 |
// UNCRUSTIFY_FORMAT_OFF |
|
424 |
- (nullable FBSDKGraphRequest *)requestForCustomAudienceThirdPartyIDWithAccessToken:(nullable FBSDKAccessToken *)accessToken |
|
425 |
NS_SWIFT_NAME(requestForCustomAudienceThirdPartyID(accessToken:)); |
|
426 |
// UNCRUSTIFY_FORMAT_ON |
|
427 |
|
|
428 |
/** |
e0ec42
|
429 |
Sets custom user data to associate with all app events. All user data are hashed |
L |
430 |
and used to match Facebook user from this instance of an application. |
2e29a3
|
431 |
|
e0ec42
|
432 |
The user data will be persisted between application instances. |
2e29a3
|
433 |
|
L |
434 |
@param email user's email |
|
435 |
@param firstName user's first name |
|
436 |
@param lastName user's last name |
|
437 |
@param phone user's phone |
|
438 |
@param dateOfBirth user's date of birth |
|
439 |
@param gender user's gender |
|
440 |
@param city user's city |
|
441 |
@param state user's state |
|
442 |
@param zip user's zip |
|
443 |
@param country user's country |
|
444 |
*/ |
|
445 |
|
|
446 |
// UNCRUSTIFY_FORMAT_OFF |
|
447 |
- (void)setUserEmail:(nullable NSString *)email |
|
448 |
firstName:(nullable NSString *)firstName |
|
449 |
lastName:(nullable NSString *)lastName |
|
450 |
phone:(nullable NSString *)phone |
|
451 |
dateOfBirth:(nullable NSString *)dateOfBirth |
|
452 |
gender:(nullable NSString *)gender |
|
453 |
city:(nullable NSString *)city |
|
454 |
state:(nullable NSString *)state |
|
455 |
zip:(nullable NSString *)zip |
|
456 |
country:(nullable NSString *)country |
|
457 |
NS_SWIFT_NAME(setUser(email:firstName:lastName:phone:dateOfBirth:gender:city:state:zip:country:)); |
|
458 |
// UNCRUSTIFY_FORMAT_ON |
|
459 |
|
e0ec42
|
460 |
/// Returns the set user data else nil |
2e29a3
|
461 |
- (nullable NSString *)getUserData; |
L |
462 |
|
e0ec42
|
463 |
/// Clears the current user data |
2e29a3
|
464 |
- (void)clearUserData; |
L |
465 |
|
|
466 |
/** |
|
467 |
Sets custom user data to associate with all app events. All user data are hashed |
|
468 |
and used to match Facebook user from this instance of an application. |
|
469 |
|
|
470 |
The user data will be persisted between application instances. |
|
471 |
|
|
472 |
@param data data |
|
473 |
@param type data type, e.g. FBSDKAppEventEmail, FBSDKAppEventPhone |
|
474 |
*/ |
|
475 |
- (void)setUserData:(nullable NSString *)data |
|
476 |
forType:(FBSDKAppEventUserDataType)type; |
|
477 |
|
e0ec42
|
478 |
/// Clears the current user data of certain type |
2e29a3
|
479 |
- (void)clearUserDataForType:(FBSDKAppEventUserDataType)type; |
L |
480 |
|
|
481 |
#if !TARGET_OS_TV |
|
482 |
/** |
|
483 |
Intended to be used as part of a hybrid webapp. |
|
484 |
If you call this method, the FB SDK will inject a new JavaScript object into your webview. |
|
485 |
If the FB Pixel is used within the webview, and references the app ID of this app, |
|
486 |
then it will detect the presence of this injected JavaScript object |
|
487 |
and pass Pixel events back to the FB SDK for logging using the AppEvents framework. |
|
488 |
|
|
489 |
@param webView The webview to augment with the additional JavaScript behavior |
|
490 |
*/ |
|
491 |
- (void)augmentHybridWebView:(WKWebView *)webView; |
|
492 |
#endif |
|
493 |
|
|
494 |
/* |
|
495 |
* Unity helper functions |
|
496 |
*/ |
|
497 |
|
|
498 |
/** |
|
499 |
Set whether Unity is already initialized. |
|
500 |
|
|
501 |
@param isUnityInitialized Whether Unity is initialized. |
|
502 |
*/ |
|
503 |
- (void)setIsUnityInitialized:(BOOL)isUnityInitialized; |
|
504 |
|
e0ec42
|
505 |
/// Send event bindings to Unity |
2e29a3
|
506 |
- (void)sendEventBindingsToUnity; |
L |
507 |
|
|
508 |
/* |
|
509 |
* SDK Specific Event Logging |
|
510 |
* Do not call directly outside of the SDK itself. |
|
511 |
*/ |
|
512 |
|
|
513 |
/** |
|
514 |
Internal Type exposed to facilitate transition to Swift. |
|
515 |
API Subject to change or removal without warning. Do not use. |
|
516 |
|
|
517 |
@warning INTERNAL - DO NOT USE |
|
518 |
*/ |
|
519 |
- (void)logInternalEvent:(FBSDKAppEventName)eventName |
e0ec42
|
520 |
parameters:(nullable NSDictionary<FBSDKAppEventParameterName, id> *)parameters |
2e29a3
|
521 |
isImplicitlyLogged:(BOOL)isImplicitlyLogged; |
L |
522 |
|
|
523 |
/** |
|
524 |
Internal Type exposed to facilitate transition to Swift. |
|
525 |
API Subject to change or removal without warning. Do not use. |
|
526 |
|
|
527 |
@warning INTERNAL - DO NOT USE |
|
528 |
*/ |
|
529 |
- (void)logInternalEvent:(FBSDKAppEventName)eventName |
e0ec42
|
530 |
parameters:(nullable NSDictionary<FBSDKAppEventParameterName, id> *)parameters |
2e29a3
|
531 |
isImplicitlyLogged:(BOOL)isImplicitlyLogged |
e0ec42
|
532 |
accessToken:(nullable FBSDKAccessToken *)accessToken; |
L |
533 |
|
|
534 |
- (void)flushForReason:(FBSDKAppEventsFlushReason)flushReason; |
2e29a3
|
535 |
|
L |
536 |
@end |
|
537 |
|
|
538 |
NS_ASSUME_NONNULL_END |