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

Allow use of gtag.js Google Analytics script #375

Closed
j-f1 opened this issue Jan 5, 2018 · 1 comment
Closed

Allow use of gtag.js Google Analytics script #375

j-f1 opened this issue Jan 5, 2018 · 1 comment
Labels
feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future.

Comments

@j-f1
Copy link

j-f1 commented Jan 5, 2018

Is this a bug report?

No

Have you read the Contributing Guidelines?

Yes.

Environment

OS: macOS 10.12.3 (16D32)
Node: v9.0.0
npm: 5.5.1
Yarn: 1.3.2

Steps to Reproduce

  1. Add a gaTrackingId to the site config.
  2. In a file added to the scripts config option, add this code:
    gtag('event', 'login')
  3. Open your website

Expected Behavior

The login event would be reported to Google Analytics via the gtag.js API.

Actual Behavior

ReferenceError: Can't find variable: gtag

Reproducible Demo

CodeWebsite

@JoelMarcey JoelMarcey added the feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future. label Feb 27, 2018
ramiel added a commit to ramiel/Docusaurus that referenced this issue Apr 25, 2018
The code now uses the new gtag script to track the website on google analytics.
The migration is explained [here](https://developers.google.com/analytics/devguides/collection/gtagjs/migration).
This will help to solve issues such as facebook#375.
As indicated at https://support.google.com/analytics/answer/1008080
the analytics code must be placed in the head tag, so it is moved there.
ramiel added a commit to ramiel/Docusaurus that referenced this issue Apr 26, 2018
The code now uses the new gtag script to track the website on google analytics.
The migration is explained [here](https://developers.google.com/analytics/devguides/collection/gtagjs/migration).
This will help to solve issues such as facebook#375.
As indicated at https://support.google.com/analytics/answer/1008080
the analytics code must be placed in the head tag, so it is moved there.
ramiel added a commit to ramiel/Docusaurus that referenced this issue Apr 26, 2018
The code now uses the new gtag script to track the website on google analytics.
The migration is explained [here](https://developers.google.com/analytics/devguides/collection/gtagjs/migration).
This will help to solve issues such as facebook#375.
As indicated at https://support.google.com/analytics/answer/1008080
the analytics code must be placed in the head tag, so it is moved there.
ramiel added a commit to ramiel/Docusaurus that referenced this issue Apr 28, 2018
The code now uses the new gtag script to track the website on google analytics.
The migration is explained [here](https://developers.google.com/analytics/devguides/collection/gtagjs/migration).
This will help to solve issues such as facebook#375.
As indicated at https://support.google.com/analytics/answer/1008080
the analytics code must be placed in the head tag, so it is moved there.
yangshun pushed a commit that referenced this issue Apr 29, 2018
* Moved google analytics script to head

The code now uses the new gtag script to track the website on google analytics.
The migration is explained [here](https://developers.google.com/analytics/devguides/collection/gtagjs/migration).
This will help to solve issues such as #375.
As indicated at https://support.google.com/analytics/answer/1008080
the analytics code must be placed in the head tag, so it is moved there.

* Add a boolean to use the new gtag library

* Update api-site-config.md
@yangshun
Copy link
Contributor

yangshun commented May 4, 2018

Has been fixed in #601 thanks to @ramiel!

@yangshun yangshun closed this as completed May 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future.
Projects
None yet
Development

No branches or pull requests

3 participants