-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Adding AngularFireAnalytics, AngularFireRemoteConfig, and refactoring DI Tokens #2187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@jhuleatt @davideast just a WIP, need to get the tests together. But feel free to start reviewing implementation and API. |
|
Hi @jamesdaniels , i find the APIs for Analytics and Remote Config quite nice. So cool to have these new features ready soon. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
* Add all, numbers, strings, and booleans Observables to AngularFireRemoteConfig * Proxy all of firebase.remoteConfig() in AngularFireRemoteConfig dealing with lazy loading of the SDK * Same effort with AngularFireAnalytics
|
Updated this branch and the comment, big changes, looking for feedback. Thanks! |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
New RC API has been published, Rocking out on docs is the plan from here and making sure the proxy doesn't explode when you try to make a call in a non-browser environment. Thanks for all the feedback! Gotta ship this and clear my plate so I can immediately jump on Angular 9 and cut AngularFire v6 after the holidays! |
This comment has been minimized.
This comment has been minimized.
|
I think I have an issue or this is due to AF RC + Angular 9 |
|
Cutting |
|
@savilaf sounds like the RC endpoint is just throttling you, this exception should affect anything other than your possibly getting more fresh values from the server. You can fix this error by either increasing your See how I addressed in one of my apps here: export class AppComponent implements OnInit, OnDestroy {
public configuration$: Observable<typeof environment.remoteConfigDefaults & Record<string, string|undefined>>;
constructor(
private remoteConfig: AngularFireRemoteConfig,
@Inject(PLATFORM_ID) private platformId: Object
) { }
ngOnInit() {
const template = environment.remoteConfigDefaults;
this.configuration$ = this.remoteConfig.parameters.pipe(
untilComponentDestroyed(this),
// rate-limit to 48-hours, unless we're not in the browser & only have defaults
isPlatformBrowser(this.platformId) ? filterFresh(172_800_000) : tap(),
first(),
mapToObject(template)
);
}
ngOnDestroy() { }
} |
|
Hi, Will there be an option to disable analytics (GDPR Europe)? It must be possible for users to opt-out from analytics. |
|
@mattgek tottally. With this API you can make it opt-in via setting Opt-out you can simply Either way you can then |
|
On Angular 9 I get when I enable the |
|
Released 5.3 with some minor changes from the last RC. Thanks for your feedback everyone, if you’re still having issues please file new issues. The priority from here will be getting ng9 / ivy support all buttoned up; and the backlog of PRs addressed. |
Adding support for Firebase v7added in 5.2.3AngularFireAnalyticsandAngularFireRemoteConfigmodulesScreenTrackingServiceandUserTrackingServicewhich operate in conjunction withAngularFireAnalyticsto track screen views and user identifiers respectivelyTODO:
startWithsupport toAngularFireRemoteConfigfilterRemote(),filterFresh(), etc. pipes in@angular/fire/remote-configdistinctUntilChangedwith a custom compare function toAngularFireRemoteConfigimplements Partial<remoteConfig.Value>in the .d.ts, so we don't break on minorsAngularFire "Lazy"
Both
AngularFireAnalyticsandAngularFireRemoteConfigare of a design @davideast and I have been thinking about for a while; that we've been calling "AngularFire Lazy".These modules not only provide convenience observables and integrations with Angular, they also lazily load their respective Firebase modules and proxy the Firebase SDK (accounting for the aforementioned lazy-loading) and patch Zone.js.
This allows you to use all of the methods available on the Firebase SDK while knowing that AngularFire has addressed Angular-compatibility. The only major difference is that anything in the vanilla Firebase SDK that isn't a promise now is.
The use of a proxy means that we should not need to add support for new additions to the Firebase SDK for you to take advantage.
Your feedback is wanted! We'll be bringing similar capabilities to the other modules in future releases 😄
@angular/fire/analyticsAngularFireAnalyticsModuleProvides
AngularFireAnalyticsand initializesScreenTrackingServiceandUserTrackingService, if they were loaded.AngularFireAnalyticsLazy loads
firebase/analyticsand proxiesfirebase.analytics().APP_VERSIONandAPP_NAMEwill be loaded into the Google Analytics, if they are provided.API
DI
ANALYTICS_COLLECTION_ENABLED: booleanGlobally disable Google Analytics collection by setting this to false. (default: true)
APP_VERSION: stringThe application version to pass to Google Analytics.
APP_NAME: stringThe application name to pass to Google Analytics.
DEBUG_MODE: booleanStart Google Analytics in debug mode, so you can test your events in DebugView in the Firebase Console. (default: false)
Also takes
FIREBASE_OPTIONSandFIREBASE_APP_NAMElike all other Modules.Usage
ScreenTrackingServiceLogs screen views and tracks the current screen on Router NavigationEnd events.
UserTrackingServiceTracks the user's uid, if
firebase/authis loaded.@angular/fire/remote-configAngularFireRemoteConfigModuleProvides
AngularFireRemoteConfigAngularFireRemoteConfigLazy loads
firebase/remote-config, proxiesfirebase.remoteConfig(), and provides convenience observables & pipes for working with Remote Config.API
DI
DEFAULT_CONFIG: {[key:string]: string|number|boolean}Provide default values for Remote Config
REMOTE_CONFIG_SETTINGS: remoteConfig.SettingsConfigure your remote config instance
Also takes
FIREBASE_OPTIONSandFIREBASE_APP_NAMElike all other Modules.Usage