Angularfire: How to use angularfire with ie11/es5

Created on 16 Apr 2020  路  5Comments  路  Source: angular/angularfire

I would like to use AngularFire to record analytics events in Chrome, FF, and IE11. Not sure what extra configuration needs to be done to my app to use AngularFire code that is ES5 compatible.

Version info

Angular: 8.2.0

Firebase: 7.6.2

AngularFire: 5.3.0

Other (e.g. Ionic/Cordova, Node, browser, operating system):
OS: Windows 10
Browser: IE11

How to reproduce these conditions

Steps to set up and reproduce

app.module.ts
AngularFireModule.initializeApp(env.firebase),
AngularFireAnalyticsModule,

components/directives
constructor(private firebase:AngularFireAnalytics, private el: ElementRef) { }

ngAfterViewInit(): void {
this.firebase.logEvent('view', this.attributes);
}

polyfills.ts
import 'core-js';
import 'proxy-polyfill/proxy.min'
import 'es6-promise';
import 'promise-polyfill';
import 'core-js/es6/symbol';
import 'core-js/es6/object';
import 'core-js/es6/function';
import 'core-js/es6/parse-int';
import 'core-js/es6/parse-float';
import 'core-js/es6/number';
import 'core-js/es6/math';
import 'core-js/es6/string';
import 'core-js/es6/date';
import 'core-js/es6/regexp';
import 'core-js/es6/map';
import 'core-js/es6/weak-map';
import 'core-js/es6/set';
import 'core-js/es6/array';
import 'core-js/es7/array'; // for .includes()
/** IE10 and IE11 requires the following for the Reflect API. */
import 'core-js/es6/reflect';
import 'core-js/es7/reflect';
import 'classlist.js'; // Run npm install --save classlist.js.

Debug output

* Errors in the JavaScript console *
Object doesn't support property or method 'logEvent'
Object doesn't support property or method 'setCurrentScreen'

Expected behavior

I would like to use AngularFire to record analytics events in Chrome, FF, and IE11. Not sure what extra configuration needs to be done to my app to use AngularFire code that is ES5 compatible.

Actual behavior

I have added polyfills and tsconfig to get my angular 8 app to load in IE11, but the AngularFire parts are throwing errors.

Most helpful comment

Hey there, our implementation isn鈥檛 quite compatible with the proxy polyfill a out there. I鈥檓 actively putting together a solution.

All 5 comments

When I look at the AngularFireAnalytics class in the IE11 debugger it contains
options;
gtag;
analyticsInitialized;
updateConfig;

but it doesn't contain any of the properties from the AnalyticsProxy type

Hey there, our implementation isn鈥檛 quite compatible with the proxy polyfill a out there. I鈥檓 actively putting together a solution.

@jamesdaniels Is there any work around in the meantime? I'd be happy if I could disable Analytics on IE11.

You need proxy-polyfill, whatwg-fetch, and something like core-js to get functionality in IE 11. See the sample project in this project for a demo of IE functionality.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

goekaypamuk picture goekaypamuk  路  3Comments

isylhdin picture isylhdin  路  3Comments

Leanvitale picture Leanvitale  路  3Comments

StephenFluin picture StephenFluin  路  3Comments

avanderbergh picture avanderbergh  路  3Comments