RefugeRestrooms / refugerestrooms

REFUGE restrooms indexes and maps safe restroom locations for trans, intersex, and gender nonconforming individuals.
http://www.refugerestrooms.org
GNU Affero General Public License v3.0
894 stars 261 forks source link

Set piwik to use async tracking in production #395

Closed stardust66 closed 6 years ago

stardust66 commented 6 years ago

This prevents the tracking script from blocking the loading of other scripts, such as the Google Maps Autocomplete script. Now, autocomplete is available right when the page loads.

Compare the difference between https://refugerestrooms.org and https://jason-refuge-staging.herokuapp.com (where async tracking has been enabled).

Context

Screenshots

Before

screen shot 2017-12-05 at 9 57 44 pm

After

image

DeeDeeG commented 6 years ago

By the way, I looked into this a bit in #375, and it seems like the company that donated a Piwik instance to Refuge isn't serving piwik.js anymore on their server, as in we don't really seem to have Piwik tracking anymore.

This PR is a fine workaround and is future-proof, especially if we consider getting Piwik up and running again. It would prepare us to better handle Piwik outages again, going forward. I just wanted to point out that the Piwik tracking isn't going to ever load as things stand at the moment, and we might think about disabling Piwik for now or seeing about spinning up another Piwik instance. I haven't seen/used the data, so someone who has used it might have more to say on that.

I tried your staging branch and it does solve the autocomplete issue. (If this PR is merged we should close #375, because this fixes that issue.)

Edit: Basically, I think we should merge this, and then we can think about whether to disable, remove, or fix Piwik. Even just merging this PR should make testing with Vagrant a bit more pleasant and we might catch bugs with Google Maps faster. Leaving as-is (post this PR) means the issue doesn't impact users much in the mean-time.

tkwidmer commented 6 years ago

LGTM, thanks @DeeDeeG and @stardust66