https://github.com/barryceelen/wp-analytics-without-cookies
Use basic Google Analytics 'universal' tracking without setting a cookie
https://github.com/barryceelen/wp-analytics-without-cookies
cookie-consent google-analytics wordpress wordpress-plugin
Last synced: 3 months ago
JSON representation
Use basic Google Analytics 'universal' tracking without setting a cookie
- Host: GitHub
- URL: https://github.com/barryceelen/wp-analytics-without-cookies
- Owner: barryceelen
- Created: 2016-09-06T18:19:04.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2017-07-27T16:31:59.000Z (almost 9 years ago)
- Last Synced: 2026-03-25T23:49:43.569Z (3 months ago)
- Topics: cookie-consent, google-analytics, wordpress, wordpress-plugin
- Language: PHP
- Size: 34.2 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Google Analytics without setting a cookie
[](https://travis-ci.org/barryceelen/wp-analytics-without-cookies)
Uses the [fingerprint2.js](https://github.com/Valve/fingerprintjs2) script to try and create a more or less unique identifier for a visitor. This will reduce the accuracy of your metrics as opposed to using Google's own methods, which may or may not be good enough for your tracking purposes.
Upside is that no tracking cookies are created which is nice if you are concerned about showing a cookie consent warning for your tracking script.
Tracking *is* harmless, right?
It does add about 30KB page weight for the fingerprint2.js script, which you may or may not like.
### Setting your analytics tracking ID
There is no settings page for this plugin. Set your own tracking id by adding a filter:
```
add_filter( 'analytics_without_cookies_tracking_id', function() { return 'UA-XXXXXXX-XX'; } );
```
### Your visitor's IP adresses are anonymized by default
Turn IP anonymization off if you are so inclined:
```
add_filter( 'analytics_without_cookies_anonymize_ip', '__return_true' );
```
### Logged in users are not tracked by default
Track logged in users:
```
add_filter( 'analytics_without_cookies_ignore_logged_in_users', '__return_false' );
```