Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StarTrial event is not sent by FB iOS SDK when a trial is activated (Purchase event is sent instead) #2196

Open
5 tasks done
maximaleks opened this issue Apr 18, 2023 · 16 comments

Comments

@maximaleks
Copy link

Checklist before submitting a bug report

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

  1. Activate auto-renewable subscription purchase with a trial in the iOS app, for example, $14.99 annually with 3-days of trial
  2. 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
}
@maximaleks
Copy link
Author

maximaleks commented Apr 18, 2023

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"
}

@Karllas
Copy link

Karllas commented Jun 18, 2023

When will this be fixed?

@eddielement
Copy link

+1

@Karllas
Copy link

Karllas commented Sep 21, 2023

Is this a bug or a feature?

@olisovenko
Copy link

Hi! Any updates on this bug?

@lucasiturbide
Copy link

Anyone knows when this will be solved or if there is a workaround ?

@YankoSoulisimo
Copy link

YankoSoulisimo commented Apr 22, 2024

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.

@hberenger
Copy link

hberenger commented Apr 29, 2024

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 called gateKeeperManager:
    • if AutoLogSubs is true, then a new subscription will be reported as a StartTrial or a Subscribe event (method logImplicitSubscribeTransaction)
    • on the contrary, if the AutoLogSubs setting is false, then any new subscription will be reported by AppEvents as a FBSDKAppEventNamePurchased event, aka fb_mobile_purchase, aka "Purchase".

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:

  1. A flag custom_events.fb_iap_is_start_trial whose value is 1,
  2. 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!

@almahdc
Copy link

almahdc commented May 7, 2024

Same issue. Some guidance from FB would be great.

@MateoParodi
Copy link

+1

1 similar comment
@SnowStorms
Copy link

+1

@HugoLec
Copy link

HugoLec commented May 23, 2024

+1 too

@Artfire
Copy link

Artfire commented Jun 4, 2024

+1

@xdstack
Copy link

xdstack commented Jul 30, 2024

Will be fixed this problem? Or it's a feature?

@denirorobert
Copy link

+1

@ninjz
Copy link

ninjz commented Sep 17, 2024

Looks like this has changed in a recent update on the server side.

I stopped getting Purchase events since the 3rd of Sept, and they seem to come in as Start Trial and Subscribe events. But getting less events than my MMP is reporting.

Does Facebook SDK only report events it attributes to Facebook?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

16 participants