Posts tagged with ads

On my website i generate leads via iframe forms. Based on the 'thank you page' i add an value to the url string like:

https//www.website.nl/thank-you?ids=5

the ids value of 5 is the value from the lead conversion (let's say $5,-)

with this script i push the value to Google Ads.

    <?php if ( is_page(123) ) { if (isset($_GET["ids"]) && (is_numeric($_GET["ids"])) ) {         $value = (float)str_replace(",",".",$_GET["ids"]);       $value = sprintf("%01.2f", $value); }else{          $value = sprintf("%01.2f", 0);  } echo '<script>  gtag("event", "conversion", {    "send_to": "AW-*****",        "value": '. $value .',     "currency": "EUR"  }); </script>';  }?> 

The above code worked great until my partner added automaticly a lead ID on the end of the url. now the thank-you url is e.g. https//www.website.nl/thank-you?ids=5&id=12345

Now my script won't work anymore... how to fix? any ideas? probably i can't add my ids to the end of the url, because i need to fill in the thank-you url in the iframe static.

hope anyone can help me out to measure conversion values again and send them over to Google Ads :)

The install referrer library is installed in my application. Through it, I get where the user came from, respectively. I want to receive the static parameter utm_source = alexander if the user has installed the application by advertising launched in Google Ads UAC. I try to set the final url suffix at the account setup level - "referrer = utm_source% 3Dalexander". But I get "utm_source = (not set)" instead of the given parameter.

But if I go directly to the link "https://play.google.com/store/apps/details?id=...&referrer=utm_source%3DAlexander", then everything works as it should and in the statistics I see - "utm_source = Alexander ".

Can you please tell me how you can configure Google UAC correctly so that the static parameter specified in advance is passed to the application?

P.S. Auto-tagging is disabled at the account level in the settings

first of all, I want to add google_mobile_ads in my pubspec. after adding it the pod install command return 404 not found.

after it, I remove my podfile & podfile.lock and run flutter clean & pod cache clean --all and trying to run again and FirebaseAnalytic & GoogleSignIn return 404 not found too.

I have a singleton class for loading and displaying ads

object AdmobProvider {     var countLoadAds = 0     lateinit var mInterstitialAd: InterstitialAd     private val adRequest = AdRequest.Builder().build()     fun init(activity: Activity) {         MobileAds.initialize(activity)         initInterstitial(activity)     }     private fun initInterstitial(context: Activity) {         mInterstitialAd = InterstitialAd(context)         if (!SubscriptionProvider.hasSubscription()) {             mInterstitialAd.adUnitId = context.getString(R.string.interstitial_video)             mInterstitialAd.loadAd(adRequest)             mInterstitialAd.adListener = object : AdListener() {                 override fun onAdClosed() {                     super.onAdClosed()                     Log.i("AdmobProvider", "onAdClosed: ")                 }                 override fun onAdFailedToLoad(p0: Int) {                     super.onAdFailedToLoad(p0)                     countLoadAds++                     Log.i("AdmobProvider", "onAdFailedToLoad: $countLoadAds")                     if (countLoadAds <= 3) {                         initInterstitial(context)                     } else {                         callback?.Failed(true)                     }                 }                 override fun onAdOpened() {                     super.onAdOpened()                     Log.i("AdmobProvider", "onAdOpened: ")                 }                 override fun onAdLoaded() {                     super.onAdLoaded()                     Log.i("AdmobProvider", "onAdLoaded: ")                     if (mInterstitialAd.isLoaded) {                         callback?.Success(true)                     }                 }             }         }     }     fun showInterstitial() {         if (mInterstitialAd.isLoaded) {             mInterstitialAd.show()         }     } } 

I load ads via

ActivityA in onCreate()

AdmobProvider.init(this) override fun Success(state: Boolean) {         Handler().postDelayed({             val intent = Intent(this@ActivityA, ActivityB::class.java)             intent.putExtra("ActivityB", 1)             startActivity(intent)             finish()         }, 200)     } 

and show in ActivityB in onCreate()

if (intent.getIntExtra("ActivityB", 0) == 1) {     AdmobProvider.showInterstitial() } 

While I tested it on the phone and emulators everything was fine, but from users, a crash began to arrive in the ActivityB, mainly on Android 8+

java.lang.RuntimeException: Unable to start activity ComponentInfo{MainActivity}: d.m: lateinit property mInterstitialAd has not been initialized     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3455)     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3598)     at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)     at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)     at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2164)     at android.os.Handler.dispatchMessage(Handler.java:107)     at android.os.Looper.loop(Looper.java:241)     at android.app.ActivityThread.main(ActivityThread.java:7582)     at java.lang.reflect.Method.invoke(Native Method)     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:941) Caused by: d.m: lateinit property mInterstitialAd has not been initialized     at .b.i(Unknown Source)     at .MainActivity.onCreate(Unknown Source)     at android.app.Activity.performCreate(Activity.java:7822)     at android.app.Activity.performCreate(Activity.java:7811)     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1328)     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3430) 

I understand what the error is, but I can't figure out how to fix it correctly, because if I initialize an advertisement in the second activity, I will need to load it there, but it doesn't suit me. According to statistics, 88% of cases crash in background. Please tell me how to fix it correctly?

i need display multiple ads on one page with this code:

<script async src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script> <div id="gpt-passback650x250"> <script> window.googletag = window.googletag || {cmd: []}; googletag.cmd.push(function() { googletag.defineSlot('/162717810/xxxxx/650x250', [650, 250], 'gpt-  passback650x250').addService(googletag.pubads()); googletag.enableServices(); googletag.display('gpt-passback650x250'); }); </script> </div> 

If i use this code twice or more on page, i get error: Exception in queued GPT command TypeError: Cannot read property 'addService' of null

Code must be same, customer want paste it to page via shortcode in cms. How to solve this? Thanks