Skip to content

Analytics: don't record page views for PR previews #11065

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 4 commits into from
Jan 29, 2024

Conversation

stsewd
Copy link
Member

@stsewd stsewd commented Jan 25, 2024

PR previews are ephemeral, they shouldn't be counted as page views.

Other changes are:

@stsewd stsewd marked this pull request as ready for review January 25, 2024 17:10
@stsewd stsewd requested a review from a team as a code owner January 25, 2024 17:10
@stsewd stsewd requested a review from humitos January 25, 2024 17:10
Copy link
Member

@humitos humitos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's great that you noticed this! 💯

Comment on lines +92 to 93
if version.is_external or not unresolved.filename:
return
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why version.is_external is required here? Won't be captured by the previous line if self.request.unresolved_domain.is_from_external_domain:

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first check is to know if we are calling the API from an external domain foo--123.readthedocs.build, this check is to know if we are recording a page view for an external version from a normal domain.

We should skip calling this endpoint from the client, probably something we can do from the addons, for our current js client, we would need to return a new field to know if the version is external.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should skip calling this endpoint from the client, probably something we can do from the addons

This makes sense. Feel free to open an issue in the addons repository and I can work on it.

The first check is to know if we are calling the API from an external domain foo--123.readthedocs.build, this check is to know if we are recording a page view for an external version from a normal domain.

Would you mind adding this knowledge as a small code comment on each check?

@stsewd stsewd merged commit 96fc90b into main Jan 29, 2024
@stsewd stsewd deleted the dont-record-page-views-for-pr-previews branch January 29, 2024 23:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants