I was trying to enable Advertiser Tracking using capacitor-community
facebook-login plugin.i found a method for enabling ( i guess ) in documentation of facebook-login plugin but there is no documentation for how to use it and demo project given also not mentioning about apis present in given plugin.
method defined in documentation:
setAdvertiserTrackingEnabled(...)
but when I try to use it I am getting the error
property ‘setAdvertiserTrackingEnabled’ does not exist on type ‘FacebookLoginPlugin’.ts(2339)
my code so far
async enableAdvertiserTracking(){
await FacebookLogin.setAdvertiserTrackingEnabled({ enabled: true; })
}
2
Answers
you can use cordova facebook-connect plugin although it bit old.it has a method to enable advertiser tracking.
https://www.npmjs.com/package/cordova-plugin-facebook-connect#facebook-sdk
The method is available in latest version ( starting from 5.0.0 ) of @capacitor-community/facebook-login.
may be you are using older version of the same plugin.you should call this method after requesting tracking permission from user in ios.
for that purpose you can use capacitor-plugin-app-tracking-transparency.as mentioned below
if you are using capacitor version below 5 you won’t be able to use
setAdvertiserTrackingEnabled
from @cacpacitor-community/facebook-login.if your are on capacitor 4 or less you can use @captive/capacitor-facebook-analytics version 1.0.0 to acheive same.in that case you have to change last few lines as below