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

Automated events from iOS aren't submitting #288

Closed
alexanderblackh opened this issue Jul 7, 2022 · 4 comments
Closed

Automated events from iOS aren't submitting #288

alexanderblackh opened this issue Jul 7, 2022 · 4 comments
Labels
wontfix This will not be worked on

Comments

@alexanderblackh
Copy link

alexanderblackh commented Jul 7, 2022

🐛 Bug Report

The application isn't firing automated automated events such as install on iOS even though tracking is enabled on both the Facebook App and our app, however, manual events are. The package works entirely as expected on Android.

To Reproduce

Expected Behavior

fb_install and other automated events will appear in the dashboard.

Code Example

info.plist

...
<key>CFBundleURLTypes</key>
	<array>
	  <dict>
	   <key>CFBundleURLSchemes</key>
	   <array>
		 <string>fbID</string>
	   </array>
	 </dict>
	</array>
	<key>FacebookAppID</key>
	<string>ID</string>
	<key>FacebookClientToken</key>
	<string>Token</string>
	<key>NSUserTrackingUsageDescription</key>
	<string>App uses some basic data to improve analytics</string>
	<key>FacebookDisplayName</key>
	<string>App</string>
	<key>FacebookAutoLogAppEventsEnabled</key>
...

App.tsx

...
 check(PERMISSIONS.IOS.APP_TRACKING_TRANSPARENCY)
      .then(result => {
        switch (result) {
          case RESULTS.UNAVAILABLE:
            console.log(
              'This feature is not available (on this device / in this context)',
            );
            break;
          case RESULTS.DENIED:
            request(PERMISSIONS.IOS.APP_TRACKING_TRANSPARENCY).then(result => {
              if (result === 'granted') {
                Settings.setAdvertiserTrackingEnabled(true);
                Settings.initializeSDK();
              }
            });
            break;
          case RESULTS.LIMITED:
            console.log('The permission is limited: some actions are possible');
            break;
          case RESULTS.GRANTED:
            Settings.initializeSDK();
            break;
          case RESULTS.BLOCKED:
            console.log('The permission is denied and not requestable anymore');
            break;
        }
      })
      .catch(error => {
        // …
      });
....

Environment

System:
    OS: macOS 12.4
    CPU: (8) arm64 Apple M1 Pro
    Memory: 545.25 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.14.0 - /usr/local/bin/node
    Yarn: 1.22.17 - /usr/local/bin/yarn
    npm: 8.3.1 - /usr/local/bin/npm
    Watchman: Not Found
  Managers:
    CocoaPods: 1.11.3 - /opt/homebrew/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
    Android SDK:
      API Levels: 23, 30, 31, 32
      Build Tools: 29.0.2, 30.0.2, 32.0.0, 32.1.0
      System Images: android-32 | Google APIs ARM 64 v8a
      Android NDK: Not Found
  IDEs:
    Android Studio: 2021.1 AI-211.7628.21.2111.8309675
    Xcode: 13.4/13F17a - /usr/bin/xcodebuild
  Languages:
    Java: Not Found
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.2 => 17.0.2 
    react-native: 0.68.2 => 0.68.2 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found
@spiritinlife
Copy link

Be aware of this facebook/facebook-android-sdk#1094

@tharwi
Copy link

tharwi commented Aug 8, 2022

Hi @alexanderblackh, did you able to solve the issue?

@tharwi
Copy link

tharwi commented Aug 9, 2022

I was able to solve the logging issue by the following code. (react-native-fbsdk-next 10.1.0)

Info.plist

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>fbID</string>
        </array>
    </dict>
</array>
<key>FacebookAppID</key>
<string>ID</string>
<key>FacebookClientToken</key>
<string>Token</string>
<key>NSUserTrackingUsageDescription</key>
<string>App uses some basic data to improve analytics</string>
<key>FacebookDisplayName</key>
<string>App</string>
<key>FacebookAutoLogAppEventsEnabled</key>
<true/>
<key>FacebookAdvertiserIDCollectionEnabled</key>
<true/>

App.js

useEffect(() => {
  const listener = AppState.addEventListener('change', (status) => {
    if (Platform.OS === 'ios' && status === 'active') {
      request(PERMISSIONS.IOS.APP_TRACKING_TRANSPARENCY)
        .then((result) => {
          if (result === RESULTS.GRANTED) {
            Settings.setAdvertiserTrackingEnabled(true);
          }
          Settings.initializeSDK();
        })
        .catch((error) => console.log(error));
    }
  });
  return AppState.removeEventListener('change', listener);;
}, []);

I was testing with the app while the Facebook app is in the background.

Event Manager has recorded multiple automatically logged events such as fb_mobile_activate_app, fb_mobile_deactivate_app, fb_sdk_settings_changed But I didn't get any install events logged in the Event Manager.

@stale
Copy link

stale bot commented Sep 8, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Sep 8, 2022
@stale stale bot closed this as completed Sep 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants