docsify icon indicating copy to clipboard operation
docsify copied to clipboard

How to use Google Analytics v2 API

Open ekoz opened this issue 3 years ago • 6 comments

Feature request

What problem does this feature solve?

I use ga plugin, set the right ga code, but Google Analytics can not recived data, ga.min.js request param is v=1, but Google Analytics gtag.js request param is v=2

1640327720(1)

What does the proposed API look like?

How should this be implemented in your opinion?

Are you willing to work on this yourself?

Yes

ekoz avatar Dec 24 '21 06:12 ekoz

Hello, not sure what issue you're having. Did you try https://docsify.js.org/#/plugins?id=google-analytics ?

trusktr avatar Dec 24 '21 09:12 trusktr

@trusktr yes, I use ga plugin like this:

<script src="//cdn.jsdelivr.net/npm/docsify/lib/docsify.min.js" data-ga="UA-XXXXX-Y"></script>
<script src="//cdn.jsdelivr.net/npm/docsify/lib/plugins/ga.min.js"></script>

but in did, the http request param is v1 version, but Google Analytics api need v2 version

ekoz avatar Dec 28 '21 01:12 ekoz

Do you mean we need a ga2.js plugin, that calls v2 APIs? It should be fairly simple if you want to make it. The code is short:

https://github.com/docsifyjs/docsify/blob/develop/src/plugins/ga.js

If you can submit a new ga2.js, that'd be awesome.

trusktr avatar Dec 29 '21 02:12 trusktr

Also if you post a live example, that'd help. I'm not experienced with ga.

trusktr avatar Dec 29 '21 02:12 trusktr

@trusktr Thanks for your reply, maybe my description is not accurate enough. I checked the code script carefully, the v1 code script src is https://www.google-analytics.com/analytics.js, the v2 code script src is https://www.googletagmanager.com/gtag/js?id=xxx, and I use ga plugin, so it is not work. I will try to write the gtag plugin, and create merge request to u.

ekoz avatar Dec 29 '21 09:12 ekoz

Hello folks!

I can see #1702 have a test failing and it does not see any action for few months. Can I help somehow?

Also, there's any documented work around to make Google Analytics work meanwhile?

idmarjr avatar Mar 15 '22 21:03 idmarjr