docbrown/app
Jeremy Friesen bde5064c9c
Skip google analytics when ga_tracking_id is nil (#15967)
* Skip google analytics when ga_tracking_id is nil

This commit involves short-circuiting Google Analytics calls when the
Forem has not configured a `Settings::General.ga_tracking_id`.  Note,
depending on your local `.env` file (or configured ENV variables) you
may have a `GA_TRACKING_ID` value set; I did, it was set to "Optional"
which overrode the database setting.

We set the HTML data properites in two places: [admin.html.erb][1] and
[application.html.erb][2].

In addition, I'm short-circuiting the local fallback analytics call (via
[Stacato][https://github.com/tpitale/staccato]).  My understanding of
Stacato, based on a cursory read, requires a Google Analytics Tracking
ID to work.

And last, we have a one off of javascript for Google Analytics tracking.

This closes #15962.

[1]:528bd2baa6/app/views/layouts/admin.html.erb (L31)
[2]:528bd2baa6/app/views/layouts/application.html.erb (L55)

How to test?

- Check your .env file to see if you have set GA_TRACKING_ID.  If so,
  unset it.
- Start with a fresh Forem instance.

- Open your browser and open the developer tools to inspect the Network
  activity.
- Open the homepage of your local Forem instance (http://localhost:3000)
- Filter your Network results for analytics.  You shouldn't see any.

Also, make sure you're disabling any blockers you might have as that
influences things.

* Commenting out GA_TRACKING_ID

Related to https://github.com/forem/forem/pull/15967

* Favor empty GA_TRACKING_ID env variable
2022-01-06 12:21:07 -05:00
..
assets Skip google analytics when ga_tracking_id is nil (#15967) 2022-01-06 12:21:07 -05:00
black_box Make Rubocop happy again (#14729) 2021-09-14 09:15:01 -05:00
components/admin/users Small change to make the tools section of member details mobile friendly. (#15159) 2021-10-22 18:47:20 +02:00
controllers Skip google analytics when ga_tracking_id is nil (#15967) 2022-01-06 12:21:07 -05:00
decorators role deprecation cleanup (#15717) 2021-12-09 15:27:45 -06:00
errors Guarding against spam from OAuth Sources (#15404) 2021-11-18 16:26:39 -05:00
forms Using a Form Object that will persist for the Creator Settings Form (#15684) 2021-12-10 17:07:40 +02:00
helpers Add crayons_icon_tag helper (#15878) 2022-01-03 09:52:05 +07:00
javascript Bump eslint from 7.32.0 to 8.6.0 (#15926) 2022-01-05 13:47:40 -05:00
lib ✂️✂️✂️ Drop PWA (#15781) 2021-12-15 21:25:04 +01:00
liquid_tags Implement TwitchTV Unified Embed (#15968) 2022-01-05 18:27:46 -05:00
mailers ✂✂✂ Remove Connect (#14734) 2021-11-18 08:21:00 -06:00
models Remove htmlentities gem (#15958) 2022-01-06 21:14:32 +07:00
policies Refactoring questions asked of user (#15762) 2021-12-21 12:45:12 -05:00
queries Favoring common method not previously available (#15855) 2021-12-22 11:00:54 -05:00
refinements Drop profile columns from user (#10707) 2020-12-03 08:14:38 +07:00
sanitizers Extracting container for allowed tags & attrs (#15338) 2021-12-16 12:24:45 -05:00
serializers Update tag search and suggest (#15810) 2022-01-05 07:51:17 +00:00
services Update tag search and suggest (#15810) 2022-01-05 07:51:17 +00:00
uploaders Added the logo upload to the admin -> customization -> config -> images section. (#15729) 2021-12-15 14:10:27 -05:00
validators Bump rubocop from 1.23.0 to 1.24.0 (#15872) 2021-12-27 10:04:59 -05:00
view_objects Upgrade to Ruby 3.0.2 (#12103) 2021-08-25 14:26:33 -04:00
views Skip google analytics when ga_tracking_id is nil (#15967) 2022-01-06 12:21:07 -05:00
workers Update deliver worker conflict strategy (#15961) 2022-01-05 11:48:22 -06:00