Google Analytics

Added v0.2.101

Adding Tracking Code

Gtag and GTM codes can now be entered in the admin area.

If you're using the simpler GTag code (i.e. you have a UA-12345678-9 style code) insert this into your <head> as high up as possible.

@include('enso-analytics::gtag');

Otherwise, if you're using Google Tag Manager (i.e. GTM-1234ABCD), insert this after the opening <head>

@include('enso-analytics::gtm-head')

...and the following after the opening <body>

@include('enso-analytics::gtm-body')

Displaying Analytics Data on Backend

You can display Google Analytics data on the backend. this is powered by Spatie's laravel-analytics package

Setup

  1. You'll need some things to config/app.php.

    'Analytics' => Spatie\Analytics\AnalyticsFacade::class,
    
    // ...
    
    Spatie\Analytics\AnalyticsServiceProvider::class,
    Yadda\Enso\EnsoAnalyticsServiceProvider::class,
    
  2. You will also need to get some API credentials. Follow the instructions on the Spatie package page.