Limit Google Optimize to 35% of loads (#98)

This commit is contained in:
Ben Halpern 2018-03-18 13:33:54 -04:00 committed by GitHub
parent 3fd1232b7e
commit d865788438
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -12,7 +12,7 @@ function initializeBaseTracking() {
wait++;
if (window.ga && ga.create) {
ga('create', '<%= ENV["GA_TRACKING_ID"] %>', 'auto');
if (!checkUserLoggedIn()) {
if (!checkUserLoggedIn() && Math.random() < 0.35) {
ga('require', '<%= ENV["GA_OPTIMIZE_ID"] %>');
}
ga('send', 'pageview', location.pathname + location.search);