Skip to content

Commit

Permalink
Add Google Analytics anonymous IP option, default set to true, fixes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddarnes committed May 30, 2019
1 parent dabf6ee commit e9dfcfc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ There are a number of optional settings for you to configure. Use the example [`

You'll need to change the `description`, `title` and `url` to match with the project. You'll also need to replace the logos, default social and default offline images in the `/assets/` directory with your own graphics. Setting the site language can be done with `lang`, the theme will default to `en-US`. The `email` needs to be changed to the email you want to receive contact form enquires with. The `disqus` value can be changed to your project username on [Disqus](https://disqus.com), remove this from the `/_config.yml` file if you don't want comments enabled. Look for the `Site settings` comment within the `/_config.yml` file. The `repo` setting is optional, for now, and can be removed entirely, if you wish.

Google Analytics can be enabled via the site configuration too. Add your tracking ID to the `/_config.yml` file in the following method: `google_analytics: 'UA-XXXXXXXX-1'`
Google Analytics can be enabled via the site configuration too. Add your tracking ID to the `/_config.yml` file in the following method: `google_analytics: 'UA-XXXXXXXX-1'`. By default all IPs of site visitors are anonymous to maintain a level of privacy for the audience. If you wish to turn this off set the `google_analytics_anonymize_ip` key to `false`.

Date format can be customised in the `/_config.yml` with the option `date_format` (please refer to Liquid date filters documentation for learning about formatting possibilities):
`date_format: "%-d %B %Y" # NOTE: only placeholder formatting is supported (do not try to use ordinal dates introduced in Jekyll 3.8)`
Expand Down Expand Up @@ -197,7 +197,6 @@ Available options:
``` yml
Twitter: "#1DA1F2"
facebook: "#3B5998"
Google+: "#DC4E41"
Pinterest: "#BD081C"
LinkedIn: "#0077B5"
tumblr: "#36465D"
Expand Down
4 changes: 1 addition & 3 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ social: # jekyll-seo-tag > social overrides
- https://twitter.com/DavidDarnes
- https://www.facebook.com/daviddarnes
- https://www.linkedin.com/in/daviddarnes
- https://plus.google.com/+DavidDarnes
- https://github.com/daviddarnes
# markdown: CommonMark # Markdown parse settings, CommonMark performs slightly better an others in build time
# commonmark:
Expand Down Expand Up @@ -92,6 +91,7 @@ repo: "https://github.com/daviddarnes/alembic"
email: "[email protected]"
# disqus: "alembic-1" # Blog post comments, uncomment the option and set the site ID from your Disqus account
# google_analytics: ''
# google_analytics_anonymize_ip: ''
# service_worker: false # Will turn off the service worker if set to false
css_inline: true # Will insert all styles into a single <style> block in the <head> element and remove the style <link> reference

Expand Down Expand Up @@ -121,15 +121,13 @@ navigation_footer:
social_links: # Appears in sidebar. Set the urls then uncomment and comment out as desired
Twitter: https://twitter.com/DavidDarnes
LinkedIn: https://www.linkedin.com/in/daviddarnes
Google+: https://plus.google.com/+DavidDarnes
GitHub: https://github.com/daviddarnes
link: https://darn.es
RSS: /feed.xml

sharing_links: # Appear at the bottom of single blog posts, uncomment and comment out as desired. Colours set the button colour
Twitter: "#0d94e7"
facebook: "#3B5998"
Google+: "#DC4E41"
# Pinterest: "#BD081C"
# LinkedIn: "#0077B5"
# tumblr: "#36465D"
Expand Down
3 changes: 3 additions & 0 deletions _includes/site-analytics.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@
gtag('js', new Date());

gtag('config', '{{ site.google_analytics }}');
gtag('config', '{{ site.google_analytics }}', {
'anonymize_ip': {{ site.google_analytics_anonymize_ip | default: "true" }}
});
</script>

0 comments on commit e9dfcfc

Please sign in to comment.