Giter Site home page Giter Site logo

Comments (18)

dhayaljaswantgit avatar dhayaljaswantgit commented on July 16, 2024 14

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

from react-native-fbsdk-next.

thebergamo avatar thebergamo commented on July 16, 2024 6

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

from react-native-fbsdk-next.

sagark1510 avatar sagark1510 commented on July 16, 2024 2

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

from react-native-fbsdk-next.

mikehardy avatar mikehardy commented on July 16, 2024 2

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

from react-native-fbsdk-next.

GabrielLiade avatar GabrielLiade commented on July 16, 2024 2

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 :)

from react-native-fbsdk-next.

glenna avatar glenna commented on July 16, 2024 1

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:

from react-native-fbsdk-next.

mikehardy avatar mikehardy commented on July 16, 2024 1

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!

from react-native-fbsdk-next.

ViktorGavrilov avatar ViktorGavrilov commented on July 16, 2024 1

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

from react-native-fbsdk-next.

iandonov avatar iandonov commented on July 16, 2024

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

from react-native-fbsdk-next.

andreshsingh avatar andreshsingh commented on July 16, 2024

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 ?

from react-native-fbsdk-next.

dhayaljaswantgit avatar dhayaljaswantgit commented on July 16, 2024

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

from react-native-fbsdk-next.

andreshsingh avatar andreshsingh commented on July 16, 2024

@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

from react-native-fbsdk-next.

futureinapps avatar futureinapps commented on July 16, 2024

@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 :(

from react-native-fbsdk-next.

ViktorGavrilov avatar ViktorGavrilov commented on July 16, 2024

@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?

from react-native-fbsdk-next.

futureinapps avatar futureinapps commented on July 16, 2024

@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.

from react-native-fbsdk-next.

futureinapps avatar futureinapps commented on July 16, 2024

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

from react-native-fbsdk-next.

futureinapps avatar futureinapps commented on July 16, 2024

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 :(

from react-native-fbsdk-next.

mikehardy avatar mikehardy commented on July 16, 2024

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

from react-native-fbsdk-next.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.