Skip to content

Google Analytics using `this.$gtag()`

Drew Baker edited this page Apr 25, 2021 · 1 revision

If you have ACF Pro installed, you will get a Site Options panel. In the Site Options you will be able to set Google Analytics codes.

By default page views are tracked, but you can track anything you want using this.$gtag() in a component or page. See: https://developers.google.com/analytics/devguides/collection/gtagjs

    this.gtag('event', <action>, {
      'event_category': <category>,
      'event_label': <label>,
      'value': <value>
    });
Clone this wiki locally