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

Enable Plausible analytics for the hosted packaging user guide #1561

Closed
ncoghlan opened this issue Jun 17, 2024 · 16 comments · Fixed by #1564
Closed

Enable Plausible analytics for the hosted packaging user guide #1561

ncoghlan opened this issue Jun 17, 2024 · 16 comments · Fixed by #1564
Labels
type: enhancement A self-contained enhancement or new feature

Comments

@ncoghlan
Copy link
Member

Activity tracking was recently enabled on the docs.python.org site, and it shows that one of the most frequently visited pages is the one for venv: https://plausible.io/docs.python.org/

The detailed page for the Google referals provides more detail on the search terms used: https://plausible.io/docs.python.org/?filters=((is,page,(/3/library/venv.html)),(is,source,(Google)))

With the high 86% bounce rate, it would be very interesting to know whether folks are leaving the site entirely because their question has already been answered, or if they're following the cross-reference link to https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/#create-and-use-virtual-environments

Since packaging.python.org is a peer subdomain of docs.python.org, enabling the data collection should just be a matter of adding in <script defer data-domain="docs.python.org" src="https://plausible.io/js/script.js"></script> as part of the Sphinx template when deploying to the main packaging.python.org environment.

The CPython docs use an environment variable to control whether or not to insert the analytics snippet (so it gets omitted in local builds of the packaging docs), and I think it would make sense to do the same thing for the packaging user guide (we could even use the same environment variable name: PYTHON_DOCS_ENABLE_ANALYTICS)

@ncoghlan
Copy link
Member Author

@willingc willingc added the type: enhancement A self-contained enhancement or new feature label Jun 19, 2024
@willingc
Copy link
Contributor

Thanks @ncoghlan. This seems like a reasonable thing to do.

@hugovk
Copy link
Contributor

hugovk commented Jun 19, 2024

I've added packaging.python.org to the Plausible account, the next step is for someone to add this snippet to some template file:

<script defer data-domain="packaging.python.org" src="https://plausible.io/js/script.js"></script>

@ncoghlan
Copy link
Member Author

ncoghlan commented Jun 19, 2024

I thought the addition of the HTML snippet was going to be straightforward, but I had forgotten that since the user guide is currently using the Furo theme without any customisations, there isn't an existing HTML template in the repo that we can drop the extra snippet into the way there was for CPython.

@pradyunsg Any suggestions for a good way to do that, which won't risk running afoul of the compatibility concerns you raise in https://pradyunsg.me/furo/customisation/injecting/ ?

@pradyunsg
Copy link
Member

pradyunsg commented Jun 19, 2024

Inject it in via https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_js_files in conf.py.

That blurb is there more for people to not generate work for me by needing me to support utterly bespoke setups with extensive customisation -- injecting a tracking JS script is a simple enough thing to do without needing custom templates and won't rely on details like class names etc in the markup.

ncoghlan added a commit to ncoghlan/packaging.python.org that referenced this issue Jun 19, 2024
Metrics are only collected for the main packaging.python.org
documentation deployments.

Closes pypa#1561
@ncoghlan
Copy link
Member Author

PR posted using html_js_files to do the injection. I ended up using RTD's standard environment variables to identify deployments specifically to packaging.python.org, so local builds, PR builds, and fork builds won't try to run the metrics collection code.

@ncoghlan
Copy link
Member Author

The site has the JS snippet up and running. Once we get the backend config sorted out, the metrics will appear at https://plausible.io/packaging.python.org/

(Hugo is chatting to Plausible and the PSF Infrastructure team to try to work out what we did wrong in the service config)

@hugovk
Copy link
Contributor

hugovk commented Jun 24, 2024

@ewdurbin Hi! I added packaging.python.org to Plausible but when I visit https://plausible.io/packaging.python.org/ I see:

This dashboard is locked because you don't have a valid subscription. Please subscribe to the appropriate tier with the link below to access the stats again.

I think this means it didn't get added to the proper PSF account, I guess it needs to be done by the primary owner.

I emailed Plausible last week to ask about it but they've not replied yet. However, I think if you visit https://plausible.io/packaging.python.org it will allow you to request an ownership transfer? Please could you try it?

Thanks!

@ewdurbin
Copy link
Member

Hi @hugovk it will not allow me to request a transfer it says that the dashboard is locked.

Can you delete the site and allow me to create it?

@ewdurbin
Copy link
Member

While here, a note that we're already at ~5M page views on docs.python.org of our 10M for the billing cycle (ending next week).

I'll reach out to plausible as well regarding what pricing options we have, but I'm worried adding packaging.python.org will over-run our plan.

@hugovk
Copy link
Contributor

hugovk commented Jun 25, 2024

Can you delete the site and allow me to create it?

Deleted.

While here, a note that we're already at ~5M page views on docs.python.org of our 10M for the billing cycle (ending next week).

I'll reach out to plausible as well regarding what pricing options we have, but I'm worried adding packaging.python.org will over-run our plan.

Plausible also offered a discount for the 20M plan. I suggest we check in again near the end of the trial when we have some numbers for packaging.python.org and decide what to do.

@ewdurbin
Copy link
Member

Site added. Invitation sent to @hugovk for Admin

@hugovk
Copy link
Contributor

hugovk commented Jun 25, 2024

Thanks, accepted!

I was going to invite @ncoghlan but the account is limited to 3 team members unless we upgrade, and we already have some people for docs.python.org. Let's try again after the trial, the limit should be 10 then.

Anyway, I've made it public at https://plausible.io/packaging.python.org and visits are being counted 📈

@ncoghlan
Copy link
Member Author

My availability is pretty erratic, so leaving me off the admin list is also fine (I'm not sure what Plausible admins have the ability to configure - the default views already seem pretty useful)

@pradyunsg
Copy link
Member

I'd like to be on the admin list, if we have the capacity to add admins without excess cost for the parties involved.

@hugovk
Copy link
Contributor

hugovk commented Jun 25, 2024

@pradyunsg I'll add you once the trial is over (assuming the limit is higher).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A self-contained enhancement or new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants