Install Google Analytics on Minimal Mistakes

less than 1 minute read

One benefit from installing Analytics is it allow us to know which post is popular. This helping us knowing what content that attract visitor a most.

Minimal Mistakes already support Google Analytics out of the box, so all we need to do is configure it.

Get Tracking ID

We can get Tracking ID from dashboard menu Admin -> Tracking Info -> Tracking Code.

Google provides a whole block of code but what we need is just the tracking ID, which has prefix UA-.

Tracking ID
Tracking ID

Edit _config.yml

Open file _config.yml. Add the following block of code at bottom of the file.

analytics:
  provider: "google-gtag"
  google:
    tracking_id: "UA-140212653-1"
    anonymize_ip: false # default

Replace tracking_id value with ID we got from the step above.

After that we just need to build or push it to repo. Hope it helps 😊.

Comments