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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do we need latest fbsdk to support iOS 14 AppTrackingTransparency #24

Closed
sagark1510 opened this issue Apr 26, 2021 · 18 comments
Closed
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers question Further information is requested

Comments

@sagark1510
Copy link

I use fbsdk just log events in the fbapp and nothing more. Do I need to upgrade to latest FBSdk and will it impact on approval of my iOS apps?

馃悰 Bug Report

To Reproduce

Expected Behavior

Code Example

Environment

@glenna
Copy link

glenna commented Apr 28, 2021

In general, the Facebook SDK is independent from the ATT framework.

Regarding the need to update your Facebook SDK to a newer version depends on how you use the Facebook SDK in your own application, and your needs for continuing to do performance marketing for, or serving ads in your app in iOS 14.5 with the new tracking requirements/restrictions in place from Apple.

If you are using Facebook's event tracking, then it is my understanding that you will need Facebook SDK version 8.1 or higher, as you need to be able to let the SDK know if you've gotten consent from the user to use their advertising identifier. You may also need to delay the initialization of the Facebook SDK in this regard as well (it depends on if you are allowing the Facebook SDK to automatically track app events such as install, purchase, etc).

I recommend taking a look at some of the available documentation to get a better idea of what you need specifically for your app:

@sagark1510
Copy link
Author

@glenna Thanks for your reply. That explains a lot.

@iandonov
Copy link

Hello,

I have an add campaign with Facebook that measures app installs.
I updated FBSD to v.4.2.0
I stated in the submission process in Apple Store that my app is using tracking functionality.

My app is rejected already twice with this statement:

  • 5.1.2 The app privacy information you provided in App Store Connect indicates you collect data in order to track the user, however, no permission request was observed.

I was thinking that permission request will be displayed automatically by the iOS.
Am I wrong?

If I only want to register app installations - do I need to use AppTrackingTransparency and to enable Facebook events?

Thanks

@mikehardy
Copy link
Collaborator

ATT is not automatic - you need https://github.com/zoontek/react-native-permissions#ios

@thebergamo thebergamo added the question Further information is requested label May 27, 2021
@thebergamo
Copy link
Owner

Seems to me that this use case is a good one to be documented for more clarity.

@thebergamo thebergamo added documentation Improvements or additions to documentation good first issue Good for newcomers labels May 27, 2021
@andreshsingh
Copy link

I have implemented the latest version of fbsdk-next and i've been using the fb events. The events are working fine on android and iOS < 14. But the events from iOS 14+ are not shown. My app doesnt show the ATT. If i show and accept ATT in the app, the events are shown.

Does this mean that fb events will only be fired when ATT is accepted ?

@mikehardy
Copy link
Collaborator

This question might be better targeted to the upstream SDK @andreshsingh , I don't think we are doing anything special there other than supporting an API to enable/disable a tracking setting before initializing the API via a second API. If you are not doing that and the events are still going or not based on ATT status, that seems like a native SDK behavior. If you try that and learn anything please share it back here!

@dhayaljaswantgit
Copy link

I've almost tried everything but not able to log Events on iOS however Android same code working fine, no build error, successfully able to run.

Here is my code =>

import {AppEventsLogger, Settings} from 'react-native-fbsdk-next';

export const facebookSDKInit = async () => {
  const trackingStatus = await requestTrackingPermission();
  if (Platform.OS === 'ios' && parseInt(Platform.Version) > 13) {
    if (trackingStatus === 'authorized') {
      await Settings.setAdvertiserTrackingEnabled(true);
    }
  }
  Settings.initializeSDK();
};

I'm calling this in App.js file on component mount and it's asking me for permission

import {AppEventsLogger, Settings} from 'react-native-fbsdk-next';
AppEventsLogger.logEvent('login',{user : 'user', email : 'email'});

On Android everything working fine

Someone can help me here

Thanks in Advance

@andreshsingh
Copy link

@dhayaljaswantgit have you tried to test if the events are firing correctly when the user has accepted ATT permission? Last time i checked it was working only for this specific scenario

@dhayaljaswantgit
Copy link

@andreshsingh Thanks for the reply, You are right, I was able to fix the issue by adding ATT permission, I've tried the same solution before logging the issue but that time it was not working, maybe I was missing something, today again I've tried this and this time it was working...

I'm adding my working code here, it may save other developers time =>

import {AppEventsLogger, Settings} from 'react-native-fbsdk-next';
import {PERMISSIONS, RESULTS, request, check} from 'react-native-permissions';

export async function initPixel() {
  if (Platform.OS === 'ios') {
    const ATT_CHECK = await check(PERMISSIONS.IOS.APP_TRACKING_TRANSPARENCY);
    if (ATT_CHECK === RESULTS.DENIED) {
      try {
        const ATT = await request(PERMISSIONS.IOS.APP_TRACKING_TRANSPARENCY);
        if (ATT === RESULTS.GRANTED) {
          Settings.setAdvertiserTrackingEnabled(true).then(() => {
            Settings.initializeSDK();
          });
        }
      } catch (error) {
        throw error;
      } finally {
        Settings.initializeSDK();
      }
      Settings.initializeSDK();
      Settings.setAdvertiserTrackingEnabled(true);
      Settings.FacebookAutoLogAppEventsEnabled(true);
    }
  } else {
    Settings.initializeSDK();
    Settings.setAdvertiserTrackingEnabled(true);
  }
} 

I'm calling this function on my App.js componentDidMount

then simply logging a event like =>

 AppEventsLogger.logEvent('test', 14, {type: 'ios'}); //Test Event

Before that make sure you should add react-native-permissions plugin and clean your project

In you Info.plist file you need to add below permission =>

NSUserTrackingUsageDescription
App would like to access IDFA for tracking purpose

Add below code to your pod file and just run pod install command and you are good to go

  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'Permission-AppTrackingTransparency', :path => "#{permissions_path}/AppTrackingTransparency/Permission-AppTrackingTransparency.podspec"

@GabrielLiade
Copy link

FacebookAutoLogAppEventsEnabled

hey ! FacebookAutoLogAppEventsEnabled is not in the Settings object, so I do a Settings.FacebookAutoLogAppEventsEnabled I have an undefined res...
Do you know where can I find the app event for install ? thanks :)

@ViktorGavrilov
Copy link

ViktorGavrilov commented Aug 29, 2021

@andreshsingh Thanks for the reply, You are right, I was able to fix the issue by adding ATT permission, I've tried the same solution before logging the issue but that time it was not working, maybe I was missing something, today again I've tried this and this time it was working...

I'm adding my working code here, it may save other developers time =>

import {AppEventsLogger, Settings} from 'react-native-fbsdk-next';
import {PERMISSIONS, RESULTS, request, check} from 'react-native-permissions';

export async function initPixel() {
if (Platform.OS === 'ios') {
const ATT_CHECK = await check(PERMISSIONS.IOS.APP_TRACKING_TRANSPARENCY);
if (ATT_CHECK === RESULTS.DENIED) {
try {
const ATT = await request(PERMISSIONS.IOS.APP_TRACKING_TRANSPARENCY);
if (ATT === RESULTS.GRANTED) {
Settings.setAdvertiserTrackingEnabled(true).then(() => {
Settings.initializeSDK();
});
}
} catch (error) {
throw error;
} finally {
Settings.initializeSDK();
}
Settings.initializeSDK();
Settings.setAdvertiserTrackingEnabled(true);
Settings.FacebookAutoLogAppEventsEnabled(true);
}
} else {
Settings.initializeSDK();
Settings.setAdvertiserTrackingEnabled(true);
}
}
I'm calling this function on my App.js componentDidMount

then simply logging a event like =>

AppEventsLogger.logEvent('test', 14, {type: 'ios'}); //Test Event
Before that make sure you should add react-native-permissions plugin and clean your project

In you Info.plist file you need to add below permission =>

NSUserTrackingUsageDescription
App would like to access IDFA for tracking purpose
Add below code to your pod file and just run pod install command and you are good to go

permissions_path = '../node_modules/react-native-permissions/ios'
pod 'Permission-AppTrackingTransparency', :path => "#{permissions_path}/AppTrackingTransparency/Permission-AppTrackingTransparency.podspec"

You are my super hero! :)
Thank you so much!

P.s. I changed only the line from
pod 'Permission-AppTrackingTransparency', :path => "#{permissions_path}/AppTrackingTransparency/Permission-AppTrackingTransparency.podspec"
to
pod 'Permission-AppTrackingTransparency', :path => "#{permissions_path}/AppTrackingTransparency.podspec"

@futureinapps
Copy link

@andreshsingh Thanks for the reply, You are right, I was able to fix the issue by adding ATT permission, I've tried the same solution before logging the issue but that time it was not working, maybe I was missing something, today again I've tried this and this time it was working...

I'm adding my working code here, it may save other developers time =>

import {AppEventsLogger, Settings} from 'react-native-fbsdk-next';
import {PERMISSIONS, RESULTS, request, check} from 'react-native-permissions';

export async function initPixel() {
if (Platform.OS === 'ios') {
const ATT_CHECK = await check(PERMISSIONS.IOS.APP_TRACKING_TRANSPARENCY);
if (ATT_CHECK === RESULTS.DENIED) {
try {
const ATT = await request(PERMISSIONS.IOS.APP_TRACKING_TRANSPARENCY);
if (ATT === RESULTS.GRANTED) {
Settings.setAdvertiserTrackingEnabled(true).then(() => {
Settings.initializeSDK();
});
}
} catch (error) {
throw error;
} finally {
Settings.initializeSDK();
}
Settings.initializeSDK();
Settings.setAdvertiserTrackingEnabled(true);
Settings.FacebookAutoLogAppEventsEnabled(true);
}
} else {
Settings.initializeSDK();
Settings.setAdvertiserTrackingEnabled(true);
}
}
I'm calling this function on my App.js componentDidMount

then simply logging a event like =>

AppEventsLogger.logEvent('test', 14, {type: 'ios'}); //Test Event
Before that make sure you should add react-native-permissions plugin and clean your project

In you Info.plist file you need to add below permission =>

NSUserTrackingUsageDescription
App would like to access IDFA for tracking purpose
Add below code to your pod file and just run pod install command and you are good to go

permissions_path = '../node_modules/react-native-permissions/ios'
pod 'Permission-AppTrackingTransparency', :path => "#{permissions_path}/AppTrackingTransparency/Permission-AppTrackingTransparency.podspec"

  1. I've done from this;
  2. I've done everything from README.

But events still don't display in FB Events page :(

@ViktorGavrilov
Copy link

@andreshsingh Thanks for the reply, You are right, I was able to fix the issue by adding ATT permission, I've tried the same solution before logging the issue but that time it was not working, maybe I was missing something, today again I've tried this and this time it was working...
I'm adding my working code here, it may save other developers time =>
import {AppEventsLogger, Settings} from 'react-native-fbsdk-next';
import {PERMISSIONS, RESULTS, request, check} from 'react-native-permissions';
export async function initPixel() {
if (Platform.OS === 'ios') {
const ATT_CHECK = await check(PERMISSIONS.IOS.APP_TRACKING_TRANSPARENCY);
if (ATT_CHECK === RESULTS.DENIED) {
try {
const ATT = await request(PERMISSIONS.IOS.APP_TRACKING_TRANSPARENCY);
if (ATT === RESULTS.GRANTED) {
Settings.setAdvertiserTrackingEnabled(true).then(() => {
Settings.initializeSDK();
});
}
} catch (error) {
throw error;
} finally {
Settings.initializeSDK();
}
Settings.initializeSDK();
Settings.setAdvertiserTrackingEnabled(true);
Settings.FacebookAutoLogAppEventsEnabled(true);
}
} else {
Settings.initializeSDK();
Settings.setAdvertiserTrackingEnabled(true);
}
}
I'm calling this function on my App.js componentDidMount
then simply logging a event like =>
AppEventsLogger.logEvent('test', 14, {type: 'ios'}); //Test Event
Before that make sure you should add react-native-permissions plugin and clean your project
In you Info.plist file you need to add below permission =>
NSUserTrackingUsageDescription
App would like to access IDFA for tracking purpose
Add below code to your pod file and just run pod install command and you are good to go
permissions_path = '../node_modules/react-native-permissions/ios'
pod 'Permission-AppTrackingTransparency', :path => "#{permissions_path}/AppTrackingTransparency/Permission-AppTrackingTransparency.podspec"

  1. I've done from this;
  2. I've done everything from README.

But events still don't display in FB Events page :(

which ios sdk do you use?

@futureinapps
Copy link

@andreshsingh Thanks for the reply, You are right, I was able to fix the issue by adding ATT permission, I've tried the same solution before logging the issue but that time it was not working, maybe I was missing something, today again I've tried this and this time it was working...
I'm adding my working code here, it may save other developers time =>
import {AppEventsLogger, Settings} from 'react-native-fbsdk-next';
import {PERMISSIONS, RESULTS, request, check} from 'react-native-permissions';
export async function initPixel() {
if (Platform.OS === 'ios') {
const ATT_CHECK = await check(PERMISSIONS.IOS.APP_TRACKING_TRANSPARENCY);
if (ATT_CHECK === RESULTS.DENIED) {
try {
const ATT = await request(PERMISSIONS.IOS.APP_TRACKING_TRANSPARENCY);
if (ATT === RESULTS.GRANTED) {
Settings.setAdvertiserTrackingEnabled(true).then(() => {
Settings.initializeSDK();
});
}
} catch (error) {
throw error;
} finally {
Settings.initializeSDK();
}
Settings.initializeSDK();
Settings.setAdvertiserTrackingEnabled(true);
Settings.FacebookAutoLogAppEventsEnabled(true);
}
} else {
Settings.initializeSDK();
Settings.setAdvertiserTrackingEnabled(true);
}
}
I'm calling this function on my App.js componentDidMount
then simply logging a event like =>
AppEventsLogger.logEvent('test', 14, {type: 'ios'}); //Test Event
Before that make sure you should add react-native-permissions plugin and clean your project
In you Info.plist file you need to add below permission =>
NSUserTrackingUsageDescription
App would like to access IDFA for tracking purpose
Add below code to your pod file and just run pod install command and you are good to go
permissions_path = '../node_modules/react-native-permissions/ios'
pod 'Permission-AppTrackingTransparency', :path => "#{permissions_path}/AppTrackingTransparency/Permission-AppTrackingTransparency.podspec"

  1. I've done from this;
  2. I've done everything from README.

But events still don't display in FB Events page :(

which ios sdk do you use?

It autolinked with 9.3 version.

@futureinapps
Copy link

may be I should do something extra in AppDelegate.m ? Something that was not provided in official documentation

@futureinapps
Copy link

I add this to AppDelegate.m to see some logs:

[FBSDKSettings enableLoggingBehavior:FBSDKLoggingBehaviorNetworkRequests];
[FBSDKSettings enableLoggingBehavior:FBSDKLoggingBehaviorDeveloperErrors];
[FBSDKSettings enableLoggingBehavior:FBSDKLoggingBehaviorInformational];
[FBSDKSettings enableLoggingBehavior:FBSDKLoggingBehaviorAppEvents];
[FBSDKSettings enableLoggingBehavior:FBSDKLoggingBehaviorGraphAPIDebugInfo];

Example of the output:
Events: [
{
"event" : {
"_eventName" : "Start",
"_logTime" : 1630410267,
"_valueToSum" : 0,
"_ui" : "UIViewController"
},
"isImplicit" : false
}
]
Flush Result : Success

Network logs response: 200 - success.

So, event are gone to FB, but not displayed in EventsManager :(

@mikehardy
Copy link
Collaborator

facebook-ios-sdk v11 (which should support it) is going to release shortly. Until then you may like #66 (comment) - please post a PR to the docs if they can be more clear, we need contributors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers question Further information is requested
Projects
None yet
Development

No branches or pull requests

10 participants