capacitor-community / capacitor-community/firebase-analytics

Firebase CORS on website

Open
#54 1 comment 1 reaction 0 assignees View on GitHub
web
Dominant language
Java
Stars
178
Forks
70
PR merge metrics
No merged PRs in 30d

Description

Hello,

I'm using this plugin in my ionic capacitor/angular project, everything is setup properly, the firebase analytics is working on iOS and Android. However I keep getting CORS error in my website (screenshot below)

![image](https://user-images.githubusercontent.com/45597942/110924513-cdd3b180-832a-11eb-8db4-adb383faaa6f.png)

my code:
```javascript
constructor(private appInsightsService: AppInsightsService, private fb: Facebook, private router: Router) {
this.initFb();
this.router.events.pipe(filter((e: RouterEvent) => e instanceof NavigationEnd)).subscribe((e: RouterEvent) => {
this.setScreenName(e.url);
});
}

async initFb() {
if (environment.production) {
if ((await Device.getInfo()).platform == 'web') {
FirebaseAnalytics.initializeFirebase(environment.firebaseConfig);
}
}
}

logEvent(name: string) {
FirebaseAnalytics.logEvent({
name,
});
}

setScreenName(screenName) {
if (environment.production) {
FirebaseAnalytics.setScreenName({
screenName,
});
}
}
```
Any ideas what i'm missing?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.