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

SKAN IDFA data not being captured #254

Open
naveen-adss opened this issue Oct 10, 2024 · 0 comments
Open

SKAN IDFA data not being captured #254

naveen-adss opened this issue Oct 10, 2024 · 0 comments

Comments

@naveen-adss
Copy link

I have two hooks one to setup adjust and another to initialise prompt for ATT permission. My react-native-adjust version is ^4.37.1

/**
 * Custom hook to initialize Adjust SDK.
 */
export const useAdjust = () => {
  useEffect(() => {
    const setupAdjust = () => {
      try {
        const token =
          Platform.OS === 'android'
            ? config.EXPO_SECRET_ADJUST_ANDROID_TOKEN
            : config.EXPO_SECRET_ADJUST_IOS_TOKEN
        const isProduction = config.APP_VARIANT === 'production'
        const adjustConfig = new AdjustConfig(
          token,
          isProduction
            ? AdjustConfig.EnvironmentProduction
            : AdjustConfig.EnvironmentSandbox
        )

        const logEnabled = yn(process.env.LOG_ADJUST, false)
        adjustConfig.setLogLevel(
          logEnabled
            ? AdjustConfig.LogLevelVerbose
            : AdjustConfig.LogLevelSuppress
        )

        Adjust.create(adjustConfig)
      } catch (err) {
        breadcrumb.error({
          category: 'Adjust',
          message: 'Error setting up adjust',
          data: {
            err,
          },
        })
        captureException(err)
      }
    }

    setupAdjust()

    return () => Adjust.componentWillUnmount()
  }, [])
}

/**
 * Custom hook to prompt ATT permission on iOS post login
 */
export const useAdjustATTPermission = () => {
  useEffect(() => {
    if (isIos) {
      try {
        // Request tracking authorization for iOS to allow IDFA usage for adjust
        Adjust.requestTrackingAuthorizationWithCompletionHandler(function (
          status
        ) {
          breadcrumb.log({
            category: 'Adjust',
            message: `Tracking authorization status is ${AdjustTrackingPermissionStatus[status]}`,
          })
        })
      } catch (err) {
        breadcrumb.error({
          category: 'Adjust',
          message: 'Error requesting ATT iOS permission for adjust',
        })
        captureException(err)
      }
    }
  }, [])
}

useAdjust is being called in root component of my react native application.

const Root = () => {
   useAdjust()
   
   return (
       <NavigationContainer ...>
           <TradingApp /> // doesn't actually reside here but inside navigation and will be routed once logged in. showing here for hierarchy reference
       </NavigationContainer/>
   )
}

const TradingApp = () => {
   useAdjustATTPermission()
   
   return (
      ....
   )
}

The IDFA data is not being captured. My question is during adjust config initialisation, should any background tracking or pre-app install tracking should be enabled ?

adjustConfig.setAllowIdfaReading(true) # should this be set to true explicitly ?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant