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

Custom Targeting #651

Open
1 task done
JoaquinManeroJazusoft opened this issue Nov 6, 2024 · 0 comments
Open
1 task done

Custom Targeting #651

JoaquinManeroJazusoft opened this issue Nov 6, 2024 · 0 comments
Labels
help wanted Extra attention is needed

Comments

@JoaquinManeroJazusoft
Copy link

What happened?

Good morning! I hope you are doing well, I wanted to ask you about whether there is a configuration to specify objectives in Ad Manager. Currently I have the problem that I cannot specify key-values ​​(in Ad Manager they are known as segmentation) and I am not being able to do it from any library and I wanted to ask if this was compatible. thank you very much in advance.
I am currently using this library, which I saw participated
ammarahm-ed/react-native-admob-native-ads#274

Platforms

Android and iOS

React Native Info

const AdView = () => {
    

    return (
      <NativeAdView
        ref={nativeAdViewRef}
        targetingOptions={
          Platform.OS === 'android'
            ? {
                targets: [
                  { key: 'ENV', value: 'TEST' },
                  { key: 'Site', value: 'Disco' },
                ],
              }
            : {
                targets: [
                  { key: 'ENV', value: 'PROD' },
                  { key: 'Site', value: 'Geant' },
                ],
              }
        }
        adUnitID={Config.GOOGLE_ADMANAGER_ADS_UNIT}
        onAdFailedToLoad={message => {
          console.log('Ad failed to load:', message);
          if (showAdd) {
            setShowAdd(false);
          }
        }}
        onAdLoaded={() => {
          console.log('Ad loaded successfully');
          if (!showAdd) {
            setShowAdd(true);
          }
        }}
        style={styles.adContainer}>
        <View style={{ alignItems: 'center', marginBottom: 30 }}>
          <ImageView
            style={{ height: wishHeight, width: screenWidth - 40 }} // Ajusta el ancho para tener en cuenta el margen
            resizeMode="contain"
          />
        </View>
      </NativeAdView>
    );
  };

Are your using Typescript?

  • My project is using Typescript

package.json

"react-native-admob-native-ads": "^0.6.6",

app.json

-

ios/Podfile

require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking")
# Resolve react_native_pods.rb with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p',
  'require.resolve(
    "react-native/scripts/react_native_pods.rb",
    {paths: [process.argv[1]]},
  )', __dir__]).strip

platform :ios, '13.0'
prepare_react_native_project!

# If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set.
# because `react-native-flipper` depends on (FlipperKit,...) that will be excluded
#
# To fix this you can also exclude `react-native-flipper` using a `react-native.config.js`
# 
# module.exports = {
#   dependencies: {
#     ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
# 
# flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled
flipper_config = FlipperConfiguration.disabled

linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
  Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
  use_frameworks! :linkage => linkage.to_sym
end

project ‘gduApp’, {
‘Debug’ => :debug,
‘DebugDevoto’ => :debug,
‘DebugGeant’ => :debug,
‘Release’ => :release,
‘ReleaseDevoto’ => :release,
‘ReleaseGeant’ => :release,
}

target 'gduApp' do
  use_expo_modules!
  post_integrate do |installer|
    begin
      expo_patch_react_imports!(installer)
    rescue => e
      Pod::UI.warn e
    end
    begin
      expo_patch_react_imports!(installer)
    rescue => e
      Pod::UI.warn e
    end
  end
  config = use_native_modules!

  # pod 'GoogleSignIn', '~> 6.1.0'
  
  # Flags change depending on the env values.
  flags = get_default_flags()
  
  pod 'Firebase', :modular_headers => true
  pod 'FirebaseCore', :modular_headers => true
  pod 'GoogleUtilities', :modular_headers => true
  pod 'Google-Mobile-Ads-SDK', '~>9.11.0'
  $RNFirebaseAsStaticFramework = true

  use_react_native!(
    :path => config[:reactNativePath],
    # Hermes is now enabled by default. Disable by setting this flag to false.
    :hermes_enabled => flags[:hermes_enabled],
    :fabric_enabled => flags[:fabric_enabled],
    # Enables Flipper.
    #
    # Note that if you have use_frameworks! enabled, Flipper will not work and
    # you should disable the next line.
    :flipper_configuration => flipper_config,
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  target 'gduAppTests' do
    inherit! :complete
    # Pods for testing
  end

  # TODO: Ver esto, el upgrade dice que hay que sacar este use_flipper
  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable the next line.
  # IS_CI = ENV['APPCENTER_BUILD_ID']

  # if not IS_CI
  #   use_flipper!(configurations: [‘Debug’, ‘DebugDevoto’,‘DebugGeant’, ’Release’,’ReleaseDevoto’, ‘ReleaseGeant’])
  # end
  post_install do |installer|
    # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
    react_native_post_install(installer, config[:reactNativePath], :mac_catalyst_enabled => false)
    installer.pods_project.build_configurations.each do |config|
      config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
    end
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
  end
end

android/build.gradle

No response

android/app/build.gradle

No response

android/settings.gradle

No response

AndroidManifest.xml

No response

@JoaquinManeroJazusoft JoaquinManeroJazusoft added the help wanted Extra attention is needed label Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant