According to the adsense documentation, maxTop is "Required when the ad unit is above the search results. Use this parameter to specify the number of ads to be shown on the top ad unit."
https://developers.google.com/custom-search-ads/s/docs/reference
Why do we need to do so? What if there are contents, little or lengthy, before the TOP ad? Is this still required?
maxTop
isn't technically required, but when you use that instead of number
it tells CSA that that block is the TOP block. The TOP block is generally more valuable since it's more likely to be seen so it's best to tell the system when you have a block like that.
If you have some content before it (a nav bar, search bars, etc) that's probably fine. If you have a lot of content before it such that the user would have to scroll to see the ads then maxTop
probably doesn't make sense.
Both number
and maxTop
will act as the max number of ads that should be shown in that block. The only difference is that it lets the system know which block is on the top of the page, and maxTop
can only be used on the first block in the page. If you have multiple blocks all others must use number
, regardless of what you use for the first block.