Skip to content

Latest commit

 

History

History

ga

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

google analytics logo

Google Analytics (analytics.js)

homepage: google.com/analytics
docs: developers.google.com/analytics/devguides/collection/analyticsjs/
import: import { Angulartics2GoogleAnalytics } from 'angulartics2';

Setup

  1. Add analytics.js tracking code provided by Google to the beginning of your body tag.

Note: If Google Analytics suggest you use gtag.js tracking code, either switch to analytics.js, or have a look at the instructions for Google Tag Manager.

  1. Remove ga('send', 'pageview'); to prevent duplicate pageview (as this is also done by angulartics):
<script>
  ...
  ga('create', 'UA-XXXXXXXX-X', 'none'); // 'none' while you are working on localhost
  ga('send', 'pageview');  // DELETE THIS LINE!
</script>
  1. Setup Angulartics using Angulartics2GoogleAnalytics