@scullyio/scully-plugin-google-analytics
Advanced tools
- Description: This plugin allows the usage of Google Analytics via Global Site Tag. - Type: Render Plugin
Weekly downloads
Readme
npm install -D @scullyio/scully-plugin-google-analytics
In the application's scully..config.ts:
The plugin's configuration receives an object like this {globalSiteTag: string}
where
the globalSiteTag
is the gtag
provided by Google Analytics.
Make a default post render array and add the plugin to it.
Set the default post renders in Scully config.
e.g.
./scully.<your-app>.config.ts
import { setPluginConfig, ScullyConfig, prod } from '@scullyio/scully';
import { GoogleAnalytics } from '@scullyio/scully-plugin-google-analytics';
const defaultPostRenderers = [];
if (prod) {
setPluginConfig(GoogleAnalytics, { globalSiteTag: 'UA-#########-1' });
defaultPostRenderers.push(GoogleAnalytics);
}
export const config: ScullyConfig = {
defaultPostRenderers,
routes: {
'/': {
type: 'contentFolder',
postRenderers: [...defaultPostRenderers],
},
},
};
ng test plugins-google-analytics
to execute the unit tests via Jest.