facebook-ios-sdk
facebook-ios-sdk copied to clipboard
StarTrial event is not sent by FB iOS SDK when a trial is activated (Purchase event is sent instead)
Checklist before submitting a bug report
- [X] I've updated to the latest released version of the SDK
- [X] I've searched for existing GitHub issues
- [X] I've looked for existing answers on Stack Overflow, the Facebook Developer Community Forum and the Facebook Developers Group
- [X] I've read the Code of Conduct
- [X] This issue is not security related and can safely be disclosed publicly on GitHub
Xcode version
14.2
Facebook iOS SDK version
16.0.1
Dependency Manager
CocoaPods
SDK Framework
Core
Goals
I noticed that StartTrial events stopped tracking after FB iOS SDK update from 15 to 16. My FB advertisement companies don't track StarTrial anymore. I want to track the StartTrial event after the user starts a trial but currently, the Purchase event is tracked instead.
Expected results
When an auto-renewable subscription is activated, StartTrial event sends from FB SDK
Actual results
Currently, the Purchase event sends after the trial is activated instead of StartTrial event.
Steps to reproduce
- Activate auto-renewable subscription purchase with a trial in the iOS app, for example, $14.99 annually with 3-days of trial
- Check what data is being sent from the Facebook SDK https://graph.facebook.com/v16.0/395012578261333/activities
Code samples & details
https://graph.facebook.com/v16.0/395012578261333/activities
{
"include_headers": "false",
"advertiser_id_collection_enabled": "0",
"event": "CUSTOM_APP_EVENTS",
"application_tracking_enabled": "1",
"ud": "{}",
"sdk": "ios",
"custom_events": "[{\"fb_transaction_id\":\"2000000315036248\",\"fb_content_title\":\"Dreamer Premium Annually\",\"fb_currency\":\"USD\",\"fb_content_id\":\"1489645075\",\"_ui\":\"off_thread\",\"_logTime\":1681806264,\"fb_transaction_date\":\"2023-04-18 11:24:09+0300\",\"fb_num_items\":1,\"_valueToSum\":14.99,\"_implicitlyLogged\":\"1\",\"fb_iap_is_start_trial\":\"0\",\"fb_iap_trial_period\":\"P3D\",\"fb_iap_trial_price\":0,\"_eventName\":\"fb_mobile_purchase\",\"fb_iap_product_type\":\"subs\",\"fb_iap_has_free_trial\":\"1\",\"fb_description\":\"Unlimited Vision Boards, Custom Affirmations\",\"fb_iap_subs_period\":\"P1Y\"}]",
"format": "json",
"extinfo": "[\"i2\",\"com.denimarina.dreamer\",\"158\",\"3.8.1\",\"15.7.4\",\"iPhone8,1\",\"en_US\",\"GMT+3\",\"NoCarrier\",375,667,\"2.00\",2,60,48,\"Europe\\\/Vilnius\"]",
"url_schemes": "[\"drbrd\",\"fb395012578261333\"]",
"advertiser_tracking_enabled": "1",
"access_token": "395012578261333|3c79dc5664c1e9acb405e423b17bfc82",
"anon_id": "XZ42AD95B7-4C1C-4371-9633-62E28FB49670"
}
{
"success": true
}
Previously in FB iOS SDK 15 StartTrial was sent after trial was activated:
{
"include_headers": "false",
"advertiser_id_collection_enabled": "0",
"event": "CUSTOM_APP_EVENTS",
"application_tracking_enabled": "1",
"ud": "{}",
"sdk": "ios",
"custom_events": "[{\"fb_content_id\":\"1489645075\",\"fb_currency\":\"USD\",\"fb_iap_has_free_trial\":\"1\",\"fb_iap_subs_period\":\"P1Y\",\"_ui\":\"off_thread\",\"_logTime\":1668581773,\"fb_transaction_date\":\"2022-11-16 08:56:06+0200\",\"fb_num_items\":1,\"_valueToSum\":14.99,\"_implicitlyLogged\":\"1\",\"fb_iap_is_start_trial\":\"1\",\"fb_iap_trial_period\":\"P3D\",\"fb_iap_trial_price\":0,\"_eventName\":\"StartTrial\",\"fb_iap_product_type\":\"subs\",\"fb_description\":\"Unlimited Vision Boards, Custom Affirmations\",\"fb_content_title\":\"Dreamer Premium Annually\",\"fb_transaction_id\":\"2000000203830320\"}]",
"format": "json",
"extinfo": "[\"i2\",\"com.denimarina.dreamer\",\"156\",\"3.5\",\"15.7.1\",\"iPhone8,1\",\"en_US\",\"GMT+2\",\"NoCarrier\",375,667,\"2.00\",2,60,51,\"Europe\\\/Vilnius\"]",
"url_schemes": "[\"drbrd\",\"fb395012578261333\"]",
"advertiser_tracking_enabled": "1",
"access_token": "395012578261333|3c79dc5664c1e9acb405e423b17bfc82",
"anon_id": "XZ4BB2E781-8D6C-413C-81C3-0EB39E0B8DE2"
}
When will this be fixed?
+1
Is this a bug or a feature?
Hi! Any updates on this bug?
Anyone knows when this will be solved or if there is a workaround ?
Hello, has this been fixed? We face the same issue - Facebook iOS SDK version: 17.0.0 We upgraded from v15.2.0 (we used this version for over half a year) and released live but then realised the StartTrial and Subscribe were not logging, only the Purchase. We cannot revert to using older version because of other constraints.
Hello, Same bug here, that I could reproduce with versions 16.3.1 and 17.0.0 of Facebook iOS SDK. I debugged the SDK to get more insight. I found an explanation as for why Free Trials are reported as "Purchase" events... but unfortunately it does not bring us any workaround.
Here is what happens:
- App Events related to InApp purchases are logged by a class named
FBSDKPaymentProductRequestor
(last commit on this class occurred on Oct 18, 2022). - The method that logs purchases/subscribes/freeTrials is
logTransactionEvent
: https://github.com/facebook/facebook-ios-sdk/blob/v17.0.0/FBSDKCoreKit/FBSDKCoreKit/AppEvents/Internal/FBSDKPaymentProductRequestor.m#L127 - The behavior of this function strongly depends on the value of a boolean setting named
FBSDKGateKeeperAppEventsIfAutoLogSubs
, provided by an object calledgateKeeperManager
:- if
AutoLogSubs
istrue
, then a new subscription will be reported as aStartTrial
or aSubscribe
event (methodlogImplicitSubscribeTransaction
) - on the contrary, if the
AutoLogSubs
setting isfalse
, then any new subscription will be reported by AppEvents as aFBSDKAppEventNamePurchased
event, akafb_mobile_purchase
, aka "Purchase".
- if
Putting a breakpoint in FBSDKGateKeeperManager
, it appears that the GateKeeper settings are a bunch of approx. 50 boolean flags that are fetched from Facebook servers at app start :
(lldb) po gateKeeper
{
FBSDKFeatureAAM = 1;
FBSDKFeatureAAMR1 = 0;
FBSDKFeatureAAMR2 = 0;
FBSDKFeatureAEM = 1;
FBSDKFeatureAEMAdvertiserRuleMatchInServer = 1;
...
FBSDKFeatureUshbaLogin = 1;
FBSDKFeatureWebViewSchemeFiltering = 1;
"app_events_if_auto_log_subs" = 0;
"app_events_killswitch" = 0;
}
It was no surprise to discover that, in my case, app_events_if_auto_log_subs
is 0
, which explains why free trial events are logged as raw Purchase
instead of StartTrial
.
Now, this explains why the SDK interprets new free trials as "Purchase" events... but it does not explains why for this app project the "Gate Keeper" parameter app_events_if_auto_log_subs
is false. I found no setting in the Event Manager web interface that could be related to the value of this flag. Is there anything that should be done on project configuration side to enable the correct logging of StartTrial events ?
Also, while inspecting the body of a fb_mobile_purchase
event sent when purchasing a subscription with free trial, I noticed that its payload contains:
- A flag
custom_events.fb_iap_is_start_trial
whose value is1
, - The full Apple In-App purchase receipt of the user.
So I guess it could still be possible, given either 1. or 2. above, to translate automatically Purchase
events into StartTrial
on back-side, in case the Apple receipt and/or the custom_events.fb_iap_is_start_trial
field say they are triggered by a Free Trial activation.
Either way, just as the other developers who commented this issue, I think it would be welcome from Facebook to indicate what has to be done so that Free Trials are correctly reported as Start Trial
instead of Purchase
events, since this analysis tends to show that the problem has (at least in part) some roots on Facebook side.
Thank you!
Same issue. Some guidance from FB would be great.
+1
+1
+1 too
+1
Will be fixed this problem? Or it's a feature?
+1