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

Website analytics #1268

Closed
feross opened this issue Jun 15, 2017 · 28 comments
Closed

Website analytics #1268

feross opened this issue Jun 15, 2017 · 28 comments

Comments

@feross
Copy link

feross commented Jun 15, 2017

How popular are the Node.js docs? I'm curious about the total monthly page views, unique visitors, and time spent on site for everything in /docs/api.

It would also be interesting to know how many page views the website as a whole receives.

@fhemberger
Copy link
Contributor

Here are the stats compared for the last two months:

Hope that helps, if you need further details, please let me know.

@feross
Copy link
Author

feross commented Jun 16, 2017

@fhemberger Thank you. Can you confirm if those counts are for the specific individual pages or for all of the pages that are in subfolders, e.g. /en/docs/*?

It appears that those numbers may be just for the individual pages, excluding most of the hits in the subfolders.

@fhemberger
Copy link
Contributor

@feross Sorry, those were the stats of /docs/, not the API docs. D'oh!

Here are the (hopefully) correct ones for the same time period:

The problem here is that /latest/ doesn't redirect to /latest-vX.X, which influences the stats

@feross
Copy link
Author

feross commented Jun 19, 2017

@fhemberger Thanks for the updated stats. I still think something doesn't look right.

How can it be that the docs were viewed only a few hundred times? I believe the stats are showing the number of times that the specific page is loaded, not including pages that are nested within.

For example, hits to https://nodejs.org/dist/latest-v8.x/ are included, but hits to https://nodejs.org/dist/latest-v8.x/docs/api/ and https://nodejs.org/dist/latest-v8.x/docs/api/buffer.html are not being included.

Otherwise, I don't see how the stats could be so low, but please correct me if I'm missing something.

@feross
Copy link
Author

feross commented Jun 19, 2017

Actually, it appears that the API docs are missing the Google Analytics script.

I see that these pages request the script:

https://nodejs.org/en/
https://nodejs.org/en/docs/

But these pages do not:

https://nodejs.org/dist/latest-v8.x/docs/api/
https://nodejs.org/dist/latest-v8.x/docs/api/buffer.html

@fhemberger Can you also confirm this?

@fhemberger
Copy link
Contributor

@feross Yes, I can confirm this. There's only a comment <!-- __TRACKING__ --> at the end of the page, but the actual tracking code seems to be missing.

Should have been replaced during the build process: /tools/doc/html.js#L155. Looks like /tools/doc/generate.js was called without the --analytics=… parameter, which seems to be the case for all latest-vX.x versions.

Just found an issue for that, dating back to January:
nodejs/node#11050

@phillipj
Copy link
Member

That's right, the docs do have support for GA tracking, but it hasn't been enabled yet because I've never been able to find where that --analytics parameter have to be added. Ref the issue @fhemberger just mentioned ^.

@fhemberger
Copy link
Contributor

@phillipj
Copy link
Member

@fhemberger: yeah, that's the $ENV variable that allows the GA code to be set when building the docs. The problem is that I haven't found where/whom $ make doc is actually run. Assumed it was some hidden CI somewhere that's only visible to those cutting new versions, but as said, never got an answer from the ones that probably has the correct answer..

Please feel free to help pinging "someone" ;)

@fhemberger
Copy link
Contributor

@nodejs/jenkins-admins to the resuce!

@rvagg
Copy link
Member

rvagg commented Jun 19, 2017

yep, one of the jenkins admins can indeed do that, is DOCS_ANALYTICS="UA-67020396-1" enough for this?

@rvagg
Copy link
Member

rvagg commented Jun 19, 2017

screenshot 2017-06-19 19 52 33

That's in there now, someone keep an eye on the next release and make sure that it comes out as you expect. As a test you should also see them show up in the nightlies and v8-canary releases from now on too.

@fhemberger
Copy link
Contributor

@rvagg Thanks, if everything works out, can we re-generate existing docs (at least latest-vX.x) as well?

@phillipj
Copy link
Member

Thanks @rvagg! 👍

@rvagg
Copy link
Member

rvagg commented Jun 19, 2017

in theory we could regenerate them all but perhaps we'd be better off doing a sed replacement on the server instead, do we have something obvious to grep for or is that all stripped out for non-GA docs?

@fhemberger
Copy link
Contributor

@rvagg There's an HTML comment <!-- __TRACKING__ --> at the end of the page. It is replaced by the doc build, so that should be fine to grep.

@phillipj
Copy link
Member

Which should be replaced with what is produced by nodejs/node/tools/doc/html.js#L171, e.g:

<script src="assets/dnt_helper.js"></script>
<script>
  if (!_dntEnabled()) {
    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;
    i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},
    i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];
    a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,
    'script','//www.google-analytics.com/analytics.js','ga');
    ga('create', 'UA-67020396-1', 'auto');
    ga('send', 'pageview');
  }
</script>

@feross
Copy link
Author

feross commented Jun 20, 2017

The latest nightly (generated today) still shows a <!-- __TRACKING__ --> comment instead of the Google Analytics script. See: https://nodejs.org/download/nightly/v9.0.0-nightly20170620d2913384aa/docs/api/

@rvagg Looks like this still might not be working?

@rvagg
Copy link
Member

rvagg commented Jun 21, 2017

screen shot 2017-06-20 at 11 12 24 pm

I'm guessing that it's something in the Makefile that's preventing this from propagating all the way through. Investigating.

@rvagg
Copy link
Member

rvagg commented Jun 21, 2017

OK, so it's because we run make doc-upload straight after make tar-upload which depends on doc so has already built the docs without tracking. The logs even show it basically doing a 3 line noop before uploading.

Inserting a make docclean just before the make doc-upload should do the trick, works locally for me at least. I've done it now on the release job, so keep an eye on the next nightly!

@rvagg
Copy link
Member

rvagg commented Jun 21, 2017

https://nodejs.org/download/nightly/v9.0.0-nightly2017062132c7f114c5/docs/api/ bingo

nodejs/node#13861 8.1.2 will probably be the first opportunity to test this on an actual release but as it's exactly the same process I don't imagine there'll be any problem. This issue can either be closed now or you could wait to confirm.

@feross
Copy link
Author

feross commented Jun 22, 2017

@rvagg Awesome! One question: will analytics be added to previous release docs once 8.1.2 is released? Or will it only be on 8.1.2 and later docs?

@fhemberger I'm still curious about the actual traffic numbers to Node.js docs, but I guess we have to wait a while to collect some data now :) Can you add me to the Google Analytics account (read-only access) so I can poke around? My email address is [email protected].

@fhemberger
Copy link
Contributor

@mikeal Can you please add @feross to Google Analytics?

@mikeal
Copy link
Contributor

mikeal commented Jul 3, 2017

I don't think I have access anymore, it was linked to my linuxfoundation.org Google Account which I don't have anymore :( Maybe @ZibbyKeaton can help.

@ZibbyKeaton
Copy link
Contributor

I do not have sufficient permissions to do that. Do you know anyone else that might @mikeal ?

@fhemberger
Copy link
Contributor

fhemberger commented Jul 4, 2017

Ok, looks like I have sufficient permissions. Just wanted to make sure it's okay, will add him later.

@fhemberger
Copy link
Contributor

@mikeal Yes, you're still registered with your linuxfoundation.org account. Do you want me to change that?

@fhemberger
Copy link
Contributor

Closing this issue for now, feel free to reopen if there are further questions regarding analytics.

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

No branches or pull requests

6 participants