How to get Google Advertisement ID in Ionic?

#1

I installed Ionic Google Analytics plugins in my app.I did’t find any function in the Google Analytics to get the Google Advertisement ID .Please help me

#2

There is probably a Cordova Plugin (and maybe matching Ionic Native plugin wrapper for easier usage) that can return this data.

#3

:grinning:Solved
Install: cordova-plugin-android-idfa
add these line in app.component.ts

declare var androidIDFA;

@Component({
  templateUrl: 'app.html',
})
export class MyApp {
googleAddId:any;
........................
.......................


if (this.platform.is('cordova')) {
    androidIDFA. getAdId(
      (addId) => {
        console.log(addId);
        this.googleAddId=addId.adId;
      },
      (e) => {
        console.log(e);
       //This error message not works on Desktops
      }
    );
  }
..............................
}
#4

Tq Sujan
I found the Plugins
cordova-plugin-android-idfa

1 Like
#5

@y12ec3231 tried as you said.am getting issue
androidIDFA is not defined .Please guide me what we miss here