README.md 763 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
# @psu/utils/analytics

Provides integration with Google Analytics

## Setup

1. Setup Google Tag Manager and generate a container ID for your app (usually non-prod + prod)
1. Provide `ANALYTICS_CONFIG` injection token and initialize it in your app initializer
1. Inject `GoogleTagManagerService` into your `AppComponent`

## ErrorInterceptor

There is an optional `ErrorInterceptor` HTTP interceptor that can log any type of network errors to Google Analytics.
There is a custom report/dashboard that you can then view to see a summary of errors.
This has been helpful to debug specific customer problems - CORS errors, anti-virus software
that disabled PUT requests, etc.

## Custom Events

`AnalyticsService` can record page views and custom analytics events.