Google analytics, privacy, and personal blog

stereobooster - Jun 17 '19 - - Dev Community

UPD: I found modern alternatives for GA. See my post here https://stereobooster.com/posts/useful-modern-tools-for-static-websites/

I want to start my personal blog and I need analytics there. I want to use Hugo (or another static site generator) and host it with Netlify (or now, or S3 + CloudFlare). This means that I need to use 3-rd party service to collect analytics, right? I do not plan to monetize blog (do not know how?), so I don't want to pay for analytics service. I guess cheapest would be to rent DigitalOcean server for 5$ month (e.g. 60$ a year). But Google analytics costs 0$. On the other hand, I concerned about the privacy of my visitors.

Demo is here. Source code is here.

Current solution

For now, I decided to use Google analytics with ganalytics.

I ask for consent before saving any data to the user device

<div class="cookie" hidden>
  <p>
    Can we store cookies on your device? See <a href='{{ .Site.BaseURL }}privacy/'>Privacy Policy</a> for details.<br>
    <button type="button" class="cookie-yes">Yes</button> <button type="button" class="cookie-close">Close</button>
  </p>
</div>
Enter fullscreen mode Exit fullscreen mode

If I don't have consent I send anonymized request to Google analytics, but don't store any identifier on the device.

If I have consent I send a regular request with stored id.

There is a form with which the user can revoke consent and erase a locally stored identifier.

<form class="consent">
  You can revoke consent and remove unique identifier ("cookies") at any time using the form below.
  <noscript>This form needs JavaScript enabled in the browser in order to work</noscript>
  <br><br>
  <input type="radio" id="agree" name="consent" value="agree">
  <label for="agree">I <b>allow</b> to store a unique identifier on my computer to track my visits to this site.</label>
  <br><br>
  <input type="radio" id="disagree" name="consent" value="disagree">
  <label for="disagree">I <b> don't allow</b> to store unique identifier on my computer.</label>
</form>
Enter fullscreen mode Exit fullscreen mode

This form is on the page with the privacy policy, which explains that the website uses Google analytics and when data sent.

Remarketing feature is turned off. Advertising Reporting Features are turned off. I don't want to share data with Google.

I simply want to know a number of views of my posts, top source of traffic (search, social, referral), maybe region - nothing fancy.

WDYT

What do you think about my solution? Is it fair privacy-wise? Do I miss something?

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player