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

App Install (MOBILE_APP_INSTALL) not being reported in events manager and test events #1094

Open
5 tasks done
spiritinlife opened this issue Jul 21, 2022 · 18 comments
Open
5 tasks done

Comments

@spiritinlife
Copy link

spiritinlife commented Jul 21, 2022

Checklist before submitting a bug report

Java version

11.0.12

Android version

API 30, Android 11

Android SDK version

14.1.0

Installation platform & version

Gradle

Package

Core & AppEvents

Goals

Being able to use App Installs as an optimisation for facebook ad campaigns.

Expected results

On a fresh install i am expecting the App install ( MOBILE_APP_INSTALL ) to appear on test events and in events manager.

Actual results

While i do see the event MOBILE_APP_INSTALL being fired by using client debugging

 FacebookSdk.addLoggingBehavior(LoggingBehavior.APP_EVENTS);
 FacebookSdk.addLoggingBehavior(LoggingBehavior.REQUESTS);
 FacebookSdk.addLoggingBehavior(LoggingBehavior.INCLUDE_RAW_RESPONSES);

The event is never shown in test events and the reported APP install events in Events Manager for my app are greatly under reported, practically not reported at all.

Important to note that other automatic logged events such as activate app are being correctly reported.

Steps to reproduce

Fresh install on an application with sdk 14.1.0 should reproduce the issue.

Code samples & details

// INSERT YOUR CODE HERE

No code should be required since we rely on AutoInitEnabled and AutoLogAppEventsEnabled. Check configuration of AndroidManifest bellow.

AndroidManifest configuration 

...
        <meta-data
            android:name="com.facebook.sdk.ApplicationId"
            android:value="@string/facebook_app_id" />

        <meta-data 
           android:name="com.facebook.sdk.ClientToken" 
           android:value="@string/facebook_client_token"/>

        <meta-data android:name="com.facebook.sdk.AutoLogAppEventsEnabled"
           android:value="true"/>

        <meta-data android:name="com.facebook.sdk.AutoInitEnabled"
           android:value="true"/>

        <meta-data android:name="com.facebook.sdk.AdvertiserIDCollectionEnabled"
            android:value="true"/>
....
  <activity
            android:name="com.facebook.FacebookActivity"
            android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
            android:label="@string/app_name" />

        <activity
            android:name="com.facebook.CustomTabActivity"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data android:scheme="@string/fb_login_protocol_scheme" />
            </intent-filter>
        </activity>
....

Sample log that shows the event being sent

 D/FacebookSDK.Request: Request:
      Id:	6
      URL:	https://graph.facebook.com/v14.0/***************/activities
      Method:	POST
      User-Agent:	FBAndroidSDK.14.1.0
      Content-Type:	application/x-www-form-urlencoded
      Parameters:
          access_token:	***************|********************************
          format:	json
          sdk:	android
          debug:	info
      Attachments:
          event:	MOBILE_APP_INSTALL
          anon_id:	**********-****-****-****-************
          application_tracking_enabled:	true
          advertiser_id_collection_enabled:	true
          advertiser_id:	*****-****-****-****-************
          advertiser_tracking_enabled:	true
          extinfo:	["a2","******",4263,"2.0.119","11","2201117TY","en_US","","NoCarrier",1080,2177,"2.75",8,-1,-1,""]
          application_package_name:	****
@spiritinlife
Copy link
Author

After a long debugging period we figured out was is the issue.

Starting from android sdk 13.0.0 the inclusion of client token means that events such as MOBILE_APP_INSTALL will include the client token in the graph request. That normally wouldn't be an issue unless you have defined ips in Server IP Whitelist which is in Settings > Advanced > Security right above the client token. It seems that for some reason and for some events such as MOBILE_APP_INSTALL facebook decided to block the request if the ip that is coming from is not whitelisted.

This is a serious issue and it is not documented at all.
How can a Server Ip whitelist affect mobile clients...?

For future travellers to the issue you should either:

  1. Not have any ip in the Server IP Whitelist
  2. Downgrade the fb sdk to a version that doesn't require the definition of client token.

@ghost
Copy link

ghost commented Jul 27, 2022

After a lot of struggle it works for me. Events started showing up on Facebook Dashboard and APP Installations was reported.

Solution that works for me: I would never believe that installing the Facebook APP on the same device I'm developing my app and logging with the same developer account and especially enabling tracking (ATT) would get things working!

Note: at first the ATT (tracking consent) was not requested when I opened the Facebook application for the first time. I was required to log in with a regular non-developer account and then enabling tracking when prompted and then log out and log in with my developer account to keep iOS privacy preferences enabled!

Captura de Tela 2022-07-27 às 14 02 04

@agGitHub
Copy link

@spiritinlife Where do you set this 'Not have any ip in the Server IP Whitelist' ? Thanks.

@ghost
Copy link

ghost commented Jul 28, 2022

@spiritinlife Where do you set this 'Not have any ip in the Server IP Whitelist' ? Thanks.

Hi @agGitHub, sorry to get in the way but if I can help, here's a screen print.

Captura de Tela 2022-07-28 às 08 58 39

@agGitHub
Copy link

agGitHub commented Aug 1, 2022

Thanks. I don't manage to find this menu. What is the path to reach it? Thanks.

@ghost
Copy link

ghost commented Aug 1, 2022

Thanks. I don't manage to find this menu. What is the path to reach it? Thanks.

developers.facebook.com → My Apps → (choose the app) → In the Dashboard, click the SETTINGS option → ADVANCED → scroll down until SECURITY.

Let me know if you find it ok?

@agGitHub
Copy link

agGitHub commented Aug 1, 2022

Thanks. I have no IP address listed here. So, what solution do I have to see my install events in AdsManager ? Except solution 2. (that is to say downgrading the SDK) Thanks !

@ghost
Copy link

ghost commented Aug 1, 2022

Believe or not, the solution that works for me was: Install the Facebook APP on the same device I'm developing my app and logging with the same developer account and enabling tracking (ATT Tracking Consent) would get things working.

@agGitHub
Copy link

agGitHub commented Aug 2, 2022

@GZaffari Thanks for your reply. So what line of code should I add in my Android app to allow this ATT Tracking (indeed, totally weird for an Android app...). I don't see any FacebookSdk.setXXXXmethod that allows to do that. Thanks.

@ghost
Copy link

ghost commented Aug 2, 2022

@GZaffari Thanks for your reply. So what line of code should I add in my Android app to allow this ATT Tracking (indeed, totally weird for an Android app...). I don't see any FacebookSdk.setXXXXmethod that allows to do that. Thanks.

@agGitHub my apologies, ATT is for iOS only. Facebook is pretty complicated, they don't care about us. In short: include your IP in both white lists, install the Facebook app on the same device you are creating.

Tell me something, on this screen (sorry for being in portuguese I couldn't change to english) do the events appear on the right side as the screenshot shows?
screenshot

@agGitHub
Copy link

agGitHub commented Aug 2, 2022

@GZaffari Thanks for your answer. Yes, I see the events for my app on the right panel as you show. I also see the events sent by my phone when I go to the 'test events' panel (you can go to this panel by clicking on the name of your game in the right panel, and then click on the button 'test events'), especially the install event (= activate app event). BUT with SDK 13.1 no install event is see by the Ads Manager. Also, it seems that the 'free trial' event (= beginning of a subscription with a free trial period) is not autologged on Android even if FacebookSdk.setAutoLogAppEventsEnabled(true) is executed in my app (bug also reported elsewhere on a FB bug ticket, without any answer for now).

Note that I don't see how this IP white list could solve anything for my users in production as they all have a different IP. I have doubts that it is required to see the events sent by your phone in the 'test events' view. And yes, this view shows the events sent by your phone if you are logged on your FB account with your phone and your browser.

@ghost
Copy link

ghost commented Aug 2, 2022

@agGitHub I understand and fully agree with the points you mentioned. I confess that I'm also pretty lost, today I removed my IP from the white lists and the events continued to work! So I'm not sure about anything anymore :( It seems to me that everything started to work when on my cell phone where my game was being tested with the Facebook SDK I installed the Facebook main application (I didn't use Facebook before) and logged in with the same developer account and in my case (iPhone) I authorized ATT (only needed for iOS) and things started to work. Unfortunately I don't know if I'll be able to help you, but anything you need let me know 👍

@nqtsparda
Copy link

I would like to check if there is any other workaround for this issue because downgrade the SDK is unacceptable for many products in the market. App Install event is one of key data for marketing, ads campaign and user analytic so I am surprise the issue has been open more than 6 months

@Juniorwar7
Copy link

Wow that's awesome 👌👌_send_code

@isidroDspot
Copy link

isidroDspot commented May 16, 2023

BUT with SDK 13.1 no install event is see by the Ads Manager. Also, it seems that the 'free trial' event (= beginning of a subscription with a free trial period) is not autologged on Android even if FacebookSdk.setAutoLogAppEventsEnabled(true) is executed in my app (bug also reported elsewhere on a FB bug ticket, without any answer for now).

@agGitHub only in-app SKU type is automatically logged. You can see it at InAppPurchaseAutoLogger.kt:21 so I guess we have to manually log subscription purchases, which are SkuType.SUBS.

I guess you solved your issue already, but this comment might be useful for other people that arrives to this issue.

@marshall86
Copy link

it's impressive how many issues there are on a sdk provided by such a big and important company... BTW do you guys know what would be a url that comes from an "install now" fb ads? is there a way to test it without creating an actual facebook ad?

@agGitHub
Copy link

Issue still not solved with SDK 16.0.0. Any solution to this issue ?

@Luisjluque
Copy link

I have inserted the sdk and also the events at code level, but in developers I can't visualize the events I have configured, I only get the standard or default events.
Captura de pantalla 2024-05-30 a la(s) 3 51 57 p  m

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

7 participants