Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable a configuration setting to set Google Analytics AnonymizeIP se… #28

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/views/layouts/quick_search/_google_analytics.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
(function(i,s,o,g,r,a,m){i["GoogleAnalyticsObject"]=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,"script","//www.google-analytics.com/analytics.js","ga");

ga("create", "<%= QuickSearch::Engine::APP_CONFIG['google_analytics_tracking_id'] %>", "auto");
ga('set', 'anonymizeIp', <%= QuickSearch::Engine::APP_CONFIG['google_analytics_anonymize_ip'] %>)
ga("send", "pageview");

</script>
Expand Down
2 changes: 2 additions & 0 deletions config/quicksearch_config.yml.example
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ defaults: &defaults
# Google Analytics client ID
# Needed for server-side GA calls (if used). Should be a random UUID
google_analytics_client_id: "a_random_uuid"
# Google Analytics anonymizeIp
google_analytics_anonymize_ip: false

# Username/password for QuickSearch stats view
user: "stats"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ defaults: &defaults
http_timeout: 1.5
xhr_http_timeout: 15
# google_analytics_tracking_id: ""
# google_analytics_anonymize_ip: false
user: "stats"
password: "stats"

Expand Down