AdSense in Ionic app


#1

I have successfully added AdMob ads on my Android version of the app.

But since I host the app in the web as well I want to add AdSense.

So far I wasn’t able to get the AdSense ads showing on the web app.

Has anyone successfully implemented AdSense on Ionic web app. If yes please share how did you do it.

My app can be viewed at iftuc.com.


#2

Hey there. Wondering if you were able to implement AdSense in your App and your experience about it. Greetings


#3

Yes done it. Android was straight forward. iOS had some issues.

You need two AdSense codes, one for each platform.
Link the adsense with your app.
List your plugins in config.xml


#4

Could you please help me how to link the AdSense with the App?
What’s the plugins you need in the config.xml?
Greetings


#5

Can you please guide how you added adsence in app? I am unable to make it run. Its run fine when i test it in chrome. But not showing ads when running in iphone app. Can you please elaborate?


#6

Hi @ubaid_iam,

OK have you added the list of plugins in config.xml:

<plugin name="cordova-plugin-admobpro" version="2.20.1"/>

This was my issue with iOS, I didn’t have this line in config.xml. As I don’t have mac and was using Ionic package service to build my apa file.

Did you create 2 AdSense codes, one for iOS one for android.

//========== adMob Code start ==========
        admobid = {};
        if( /(android)/i.test(navigator.userAgent) ) { // for android & amazon-fireos
            admobid = {
                banner: 'ca-app-pub-3xxxx/8xxxxx',
                interstitial: 'ca-app-pub-3xxxx/8xxxxx'
            };
        } else if(/(ipod|iphone|ipad)/i.test(navigator.userAgent)) { // for ios
           admobid = {
               banner: 'ca-app-pub-4xxxx/8xxxxx', 
               interstitial: 'ca-app-pub-4xxxx/8xxxxx'
           };
       }
       try {
            AdMob.createBanner({
                adId: admobid.banner,
                position: AdMob.AD_POSITION.BOTTOM_CENTER,
                autoShow: true
            });
        } catch (e) {}
//========== adMob Code end ==========


#7

Hi @bgosalci

Aren’t this the plugin of Admob. I thought you included Adsense in your app. For Adsense i have included the html code with a script. Its loading ads when i am testing it in chrome. But not loading when running in ios app.

I am not using Admob because i want to include my ads in a list as one of the list item. Admob plugin only provides fixed positions on screen.

I am using ionic for front end and angularjs for backend. its a cross platform app.