If your Shopify store shows the Google Customer Reviews badge, it's probably adding about 0.2 to your Cumulative Layout Shift (CLS) on every phone page load, twice the 0.1 that Google counts as good. Google's script loads the badge in a frame parked far off screen, then moves it into the corner, and Chrome counts that move as a layout shift. Two short CSS rules keep the badge exactly where it is and remove the shift.
We found this in October on a client's Shopify store. Here's how it happens, how to check your store and how to fix it.
What the badge does to your layout shift score
The older badge code, which some review apps add for you, works in three steps:
- It adds an empty box pinned to a bottom corner of the screen.
- It loads the badge in a frame and parks that frame 10,000 pixels above the corner, far off screen, until it's ready.
- It moves the frame into the box, then resizes it. On a phone in our tests, it went from 450 by 150 pixels to 614 by 64, then to 86 by 64.
CLS scores a shift by multiplying how much of the screen the moving element covers by how far it moved, and a jump from far off screen counts as the largest possible move. On a phone screen 390 pixels wide and 844 tall, the 150-pixel-tall frame spans the full width, so that one move scores 150 divided by 844, or 0.178. When the frame then shrinks to 64 pixels tall, the box stays pinned by its bottom edge, so its top edge drops and adds another 0.018.
That's 0.196 on every phone page load that shows the badge. Google's guide to CLS sets the bar for good at 0.1 or less on at least 75 percent of page loads.
Google's Merchant Center help page for the store widget now says the badge "has been upgraded to the new store widget" and offers new code. Stores still on the old code get the new design inside the old frame, and the shift comes with it.
How to tell if the badge is hurting your store
Run your home page through PageSpeed Insights and open "Layout shift culprits" in the performance insights. If the badge is the problem, it's listed as body > div#___ratingbadge_0 (three underscores before "ratingbadge").
Don't trust a phone lab score of 0 on its own: some of our client's phone runs read 0 because the test ended before the badge appeared. The desktop run is more reliable, and so is a live check in Chrome.
For the live check, open a page on your store and wait for the badge to appear. Open the Console in Chrome's developer tools (Command+Option+J on a Mac, Ctrl+Shift+J on Windows). Chrome may ask you to type "allow pasting" first. Then paste this short script, which lists every layout shift on the page, and press Enter:
new PerformanceObserver((list) => {
for (const shift of list.getEntries()) {
console.log(
shift.value.toFixed(3),
shift.sources.map((s) => s.node)
);
}
}).observe({
type: 'layout-shift',
buffered: true,
});
Each line is one shift: its score, then the elements that moved. Lines that mention ___ratingbadge_0 are the badge.
The CSS fix
If your badge sits in the bottom-left corner, add this to your theme's CSS:
#___ratingbadge_0 {
top: 100% !important;
bottom: auto !important;
transform: translateY(-100%);
}
#___ratingbadge_0 > iframe[style*="-10000px"]:not([style*="static"]) {
visibility: hidden !important;
}
What each part does:
-
top: 100%andbottom: autopin the box by its top edge to the bottom of the screen, so the badge can change size without that edge moving. Google sets the box's position in an inline style, and!importantlets your CSS win. -
transform: translateY(-100%)lifts the box back up by its own height, so it sits exactly where it did before. Chrome doesn't count transforms as layout shifts. - The second rule hides the frame while it's parked off screen, and a hidden frame moving isn't a shift. Once Google moves the frame into place, its inline style changes, the rule stops matching and the badge appears in the corner.
Both rules matter. In our tests, leaving out the second rule left 0.178 of shift, and leaving out the first left 0.049.
If your badge sits bottom right, anchor its left edge as well. Otherwise every change in the badge's width moves that edge. In our test, a bottom-right badge still shifted 0.176 with the version above, and 0 with this one:
#___ratingbadge_0 {
top: 100% !important;
bottom: auto !important;
left: 100% !important;
right: auto !important;
transform: translate(-100%, -100%);
}
#___ratingbadge_0 > iframe[style*="-10000px"]:not([style*="static"]) {
visibility: hidden !important;
}
Where to add the CSS on Shopify
Test on a copy first. In your Shopify admin, go to Online Store, open the menu on your live theme (the button with three dots) and choose Duplicate. Add the CSS to the copy, preview it and run the Console check, then make the same change on your live theme. The CSS can go in one of two places:
- Your theme's stylesheet. A developer can add it to the CSS file that holds your other customizations, which is where it lives on our client's store.
- The theme editor. Custom CSS under Theme settings applies to the whole site and takes up to 1,500 characters, and these rules use under 300. Don't use a section's Custom CSS box: Shopify limits that CSS to the section, and the badge sits outside every section.
Shopify warns that theme updates can stop custom CSS from working, so run the check again after one.
The result on a live store
The fix went live on our client's store on October 31. With the badge still loading, PageSpeed Insights' phone lab CLS for the home page went from 0.182 to 0, and desktop checks showed no badge shifts on the home, product or cart pages. That 0.182 is the same move on the 412 by 823 phone screen that PageSpeed Insights simulates.
We re-ran the test on November 1 in Chrome at 390 by 844 pixels. We loaded the live home page five times as served, and five times with the two rules removed in our test browser only. Without the fix, the badge shifted 0.196 on every load. With it, 0 every time, and the badge finished in the same spot at the same size. Product and cart pages matched.
The store's phone CLS in PageSpeed Insights' real-user data had read 0.23 to 0.27 for most of a year. That figure takes about a month to catch up.
If you also run a Klaviyo teaser
Klaviyo's sign-up teaser, the small tab that reopens a pop-up, also lives in a bottom corner. Google gives the badge the highest z-index a browser allows and Klaviyo gives the teaser 90,000, so both can sit above your cart drawer. Google also asks stores not to cover the widget. When we stacked the two on our client's store, we:
- Lowered the badge to 997 and the teaser to 998, raised both when they have keyboard focus, and dropped both below the theme's drawers while one is open.
- Moved Klaviyo's desktop rectangle beside the badge so it doesn't cover it.
On phones, Klaviyo shows a small triangle that only works flush in the corner, so if it shares a corner with the badge, it covers the badge. Put the two in opposite corners. The badge's corner is set in its code or in your review app's settings, and the bottom-right version of the fix above covers that side.
Questions we hear
Will the fix change how the badge looks or works?
No. In our tests the badge ended in the same place at the same size with and without the fix, and nothing covered it, so shoppers can still click it. It just doesn't jump into place anymore.
Should I switch to Google's new store widget code?
It's worth testing. In three test loads on a page we built, the new code drew its button with no layout shift, but we haven't measured it on a live store, so run the Console check after you switch. If an app still adds the old code, the CSS above covers you.
Does the badge hurt CLS on desktop too?
Less. On a 1,350 by 940 desktop screen it shifted 0.057 per load: under 0.1 on its own, but added to every other shift on the page. The same CSS removes it.
How long until PageSpeed Insights shows the improvement?
The lab test reflects it on the next run. The real-user data covers the previous 28 days, so it improves gradually over about four weeks.
Braun Design Co is a boutique Shopify Plus partner in Austin. Custom themes, migrations, and ongoing performance and maintenance work for brands that already sell.
If an app is dragging down your Core Web Vitals, we can find which one and fix it without losing the feature. Book a 30-minute call.