8000 Deprecate google_analytics config option. by waylan · Pull Request #2253 · mkdocs/mkdocs · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Deprecate google_analytics config option. #2253

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

Merged
merged 8 commits into from
Jun 2, 2021
Merged

Conversation

waylan
Copy link
Member
@waylan waylan commented Dec 14, 2020

This implements the plan discussed in #2252.

On the built-in themes I added a new option theme.analytics.gtag. See the documentation for details. The idea is that multiple different services could be offered under theme.analytics. At this time only support for gtag exists, but more could be added in the future.

I made some changes and additions to the Deprecated option validator which still needs tests.

We also need to upgrade the Google Analytics account for https://mkdocs.org to use the new GA4 ID. Until we do, builds will issue a warning:

$ mkdocs build
WARNING -  Config value: 'google_analytics'. Warning: The configuration option 
google_analytics has been deprecated and will be removed in a future release o
f MkDocs. See the options available on your theme for an alternative.
INFO    -  Cleaning site directory
INFO    -  Building documentation to directory: /Users/waylan/Code/mkdocs/site
INFO    -  Documentation built in 0.99 seconds

@squidfunk
Copy link
Contributor
squidfunk commented Dec 15, 2020

I haven't tested it but the proposal sounds great. I also like the extensible approach of theme.analytics.* and will implement it in Material for MkDocs.

@waylan
Copy link
Member Author
waylan commented Dec 16, 2020

The integration tests will continue to fail until we update our own config to use the new gtag (they build the docs in strict mode).

In all other respects, this should be ready to go.

@waylan
Copy link
Member Author
waylan commented Dec 16, 2020

@tomchristie can we get the Google Analytics account for https://mkdocs.org upgraded to V4 (as documented here)? We then need the G-ABC123 format ID to put in the config file.

diff --git a/mkdocs.yml b/mkdocs.yml
index f120128f..1aed065e 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -8,6 +8,7 @@ edit_uri: ""

 theme:
     name: mkdocs
+    analytics: {gtag: 'G-ABC123'}
     highlightjs: true
     hljs_languages:
         - yaml
@@ -40,7 +41,6 @@ markdown_extensions:
         repo: mkdocs

 copyright: Copyright &copy; 2014 <a href="https://twitter.com/_tomchristie">Tom Christie</a>, Maintained by the <a href="/about/release-notes/#maintenance-team">MkDocs Team</a>.
-google_analytics: ['UA-27795084-5', 'mkdocs.org']

 plugins:
     - search

@waylan waylan linked an issue Dec 16, 2020 that may be closed by this pull request
@alex-klimov
Copy link

Hi guys, what is the status? Do you think this would be completed any time soon?

@waylan
Copy link
Member Author
waylan commented Apr 7, 2021

@tomchristie can we upgrade the Google Analytics account as discussed above?

If not, then we will need to work out some other solution to avoid the tests failing for the build of our own documentation.

@tomchristie
Copy link
Member

Right okay, this got buried. I'll put it on my TODO.

@waylan
Copy link
Member Author
waylan commented Jun 1, 2021

@tomchristie sorry to pester you but this is the only issue blocking the next release. If we are not going to get this update, we need to know so that we can plan around it.

@tomchristie
Copy link
Member
8000
tomchristie commented Jun 2, 2021

The UI is a bit inscrutable, but.... is this what you need?

Screenshot 2021-06-02 at 10 33 20

Failing that we could also perfectly well just drop the GA from the MkDocs site.

@waylan
Copy link
Member Author
waylan commented Jun 2, 2021

Yes, that resolves it. Thank you.

@waylan waylan merged commit 80feaf0 into mkdocs:master Jun 2, 2021
@waylan waylan deleted the gtag branch June 2, 2021 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Google Analytics v4 (gtag)
4 participants
0