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

Update readme with browser support and FAQ section about analytics and personalization #1155

Merged
merged 4 commits into from
Apr 19, 2024

Conversation

@westonruter westonruter added [Type] Documentation Documentation to be added or enhanced [Plugin] Speculative Loading Issues for the Speculative Loading plugin (formerly Speculation Rules) labels Apr 16, 2024
@westonruter westonruter added this to the speculation-rules n.e.x.t milestone Apr 16, 2024
@westonruter westonruter requested a review from tunetheweb April 16, 2024 18:40
@westonruter westonruter requested a review from felixarntz as a code owner April 16, 2024 18:40
Copy link

github-actions bot commented Apr 16, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: westonruter <[email protected]>
Co-authored-by: tunetheweb <[email protected]>
Co-authored-by: adamsilverstein <[email protected]>
Co-authored-by: mukeshpanchal27 <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Co-authored-by: tunetheweb <[email protected]>
@westonruter westonruter force-pushed the add/speculation-rules-faq branch from 272a47b to 27b1773 Compare April 17, 2024 17:01
@westonruter westonruter changed the title Add FAQ section about analytics and personalization Update readme with browser support and FAQ section about analytics and personalization Apr 17, 2024
Copy link
Contributor

@tunetheweb tunetheweb left a comment

Choose a reason for hiding this comment

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

LGTM

@mukeshpanchal27 mukeshpanchal27 merged commit da0ecbc into trunk Apr 19, 2024
8 checks passed
@mukeshpanchal27 mukeshpanchal27 deleted the add/speculation-rules-faq branch April 19, 2024 08:29
Copy link
Member

@felixarntz felixarntz left a comment

Choose a reason for hiding this comment

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

@westonruter I realize this was merged, but had it open for a while and wanted to take a look now. Leaving a bit of feedback. If there's consensus, we should be able to quickly address in a follow up PR.

cc @tunetheweb


For client-side JavaScript, is recommended to delay these until the page clicks and some solutions (like Google Analytics) already do this automatically for prerender. See [Impact on Analytics](https://developer.chrome.com/docs/web-platform/prerender-pages#impact-on-analytics). Additionally, cross-origin iframes are not loaded until activation which can further avoid issues here.

Speculating on hover (moderate) increases the chance the page will be loaded, over preloading without this signal, and thus reduces the risk here. Alternatively, the plugin offers to only speculate on mouse/pointer down (conservative) which further reduces the risk here and is an option for sites which are concerned about this, at the cost of having less of a lead time and so less of a performance gain.
Copy link
Member

Choose a reason for hiding this comment

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

I find "over preloading without this signal" complicated to understand. What's a "signal"? I definitely think the language here can be simplified.

Is this supposed to mean "speculating on hover increases the chance ... over speculating on eager"?

Also since "speculating on hover (moderate)" is the default in this plugin anyway, I think it's worth formulating this response with that context, just to reiterate here that this is the default that the plugin uses.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's supposed to me "speculating on hover increases the chance of the page actually being visited, and so reduces the chance of any negative impact on analytics due to pages being prerendered (and being included in analytics) but not actually being seen by a user".

I agree the wording could be clearer.

And btw, it may should a bit dismissive to say "hey, if there's a bigger chance of a page being visited, then it's OK if your analytics are off sometimes", but the reality is this already happens in many cases. For example, people opening in a new tab and not actually visiting it. Or open a link, not reading it, but intending to come back to it (but never doing that).


Prerendering can affect analytics and personalization.

For client-side JavaScript, is recommended to delay these until the page clicks and some solutions (like Google Analytics) already do this automatically for prerender. See [Impact on Analytics](https://developer.chrome.com/docs/web-platform/prerender-pages#impact-on-analytics). Additionally, cross-origin iframes are not loaded until activation which can further avoid issues here.
Copy link
Member

Choose a reason for hiding this comment

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

What is "until the page clicks"? Is that the most suitable term here? I would assume there's an easier-to-understand way to indicate that the page has actually become active / that the user is actually visiting the page.

Copy link
Contributor

@tunetheweb tunetheweb Aug 12, 2024

Choose a reason for hiding this comment

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

Fair point. The term we usually use is "when the prerender is activated"/"activation" since this matches the activationStart time in the Performance Navigation Timing API

Suggested change
For client-side JavaScript, is recommended to delay these until the page clicks and some solutions (like Google Analytics) already do this automatically for prerender. See [Impact on Analytics](https://developer.chrome.com/docs/web-platform/prerender-pages#impact-on-analytics). Additionally, cross-origin iframes are not loaded until activation which can further avoid issues here.
For client-side JavaScript, it is recommended to delay these until the prerender is activated (for example but clicking on the link) and some solutions (like Google Analytics) already do this automatically for prerender. See [Impact on Analytics](https://developer.chrome.com/docs/web-platform/prerender-pages#impact-on-analytics). Additionally, cross-origin iframes are not loaded until activation which can further avoid issues here.


Speculating on hover (moderate) increases the chance the page will be loaded, over preloading without this signal, and thus reduces the risk here. Alternatively, the plugin offers to only speculate on mouse/pointer down (conservative) which further reduces the risk here and is an option for sites which are concerned about this, at the cost of having less of a lead time and so less of a performance gain.

A prerendered page is linked to the page that prerenders it, so personalisation may already be known by this point and changes (e.g. browsing other products, or logging in/out) may require a new page load, and hence a new prerender anyway, which will take these into account. But it definitely is something to be aware of and test!
Copy link
Member

Choose a reason for hiding this comment

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

What can be done if the test leads to discovering problems? I think something should be included about that, e.g. something about modifying the personalization logic or, if that's not possible/feasible, excluding the relevant pages from speculative loading (via the filter the plugin provides).

Copy link
Contributor

Choose a reason for hiding this comment

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

The options (from best to worse IMHO) are:

  • Cancel speculations on personalization changes (note this happens automatically on navigations anyway, which is probably when most personalization signal changes and other state changes happen anyway).
  • Update on page activation with client-side JS (plus: also could handle stale background tabs, negative: can lead to a flash of old content(
  • Don't speculation on hover and only do on mousedown / "conservative" eagerness. (negative, less gain).
  • Exclude personalized pages (but if this is a loging widget for example that might be ALL pages)
  • Don't use speculation rules on those types of sites.

Probably not a bad idea to spell these out.

@westonruter
Copy link
Member Author

@felixarntz I'll defer to @tunetheweb as he's the wordsmith here.

@westonruter
Copy link
Member Author

Maybe we should copy the readme into a Google Doc to better collaborate on the copy (and leverage the new Copy/Paste as Markdown feature!)

@westonruter
Copy link
Member Author

I created a doc and shared it with ya'll.

@westonruter
Copy link
Member Author

I've opened #1459 to track this work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Plugin] Speculative Loading Issues for the Speculative Loading plugin (formerly Speculation Rules) [Type] Documentation Documentation to be added or enhanced
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants