2

what are the rules with google (or any other search engine) in regards to cloaking (e.g. showing different content for bots vs real users)

The question is what if we want to load certain content only when the user scrolls/interacts but still have google/bots (which doesn’t scroll) crawl that content.. Would it be OK to have a condition in JS that checks if this is a BOT (via userAgent) and loads that content.. but for regular user (non bots) this will only happen when they first interact with the page (e.g. mousemove keypress scroll).

It is not really cloaking as by the end of the day the content will be the same for both (as soon as the user interacts with the page)

In this particular example this is about navigation mega Menu that fetches data and loads only upon user's first interaction. This increases the page performance by not fetching unnecessary calls and heavy DOM before it is ever needed.




Sample code:

if(/bot|spider|crawler|slurp/.test(navigator.userAgent)){
  // load and render content
} else {
 onFirstInteraction.then(event => {
  // load and render content
 });
}
0

1 Answer 1

2

What you're talking about is called an infinite scrolling page (E.g. TechCrunch which just loads a new article as you keep scrolling down).

The SEO advice from Google regarding the matter is to ensure you also have a paginated series available. The infinite scrolling will help users, while the pagination will allow Google to jump through pages and see the rest of the content.

You can read more here: https://webmasters.googleblog.com/2014/02/infinite-scroll-search-friendly.html

I would highly recommend against filtering by user-agent. There's a high risk of that being considered cloaking.

2
  • Not exactly like infinite scrolling, it is rather a navigation mega menu that is deferred to load only after interactions..
    – adardesign
    Dec 19, 2019 at 18:37
  • I get deferring loading of a menu for performance, but it seems like it could be deferred until after page load rather than until user interaction. Then users and bots would both see it. Dec 19, 2019 at 18:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.