Why scripts do not work
When you use Insert then Embed, Google Sites places your code in a frame served from a different Google domain. Code inside that frame cannot read the address of the page, the referrer or the visitor's navigation, so a tracker would only see the frame itself. That is a deliberate security choice by Google, not a bug.
Option 1: Google Analytics, built in
Google Sites has a setting for a Google Analytics measurement ID (in the site settings, under Analytics). It is the only full analytics that runs on the page itself. Bear in mind that Google Analytics uses cookies.
Option 2: a simple hit counter
Create a free image hit counter, then use Insert, Embed, Embed code and paste the HTML image tag. It counts how many times the page with the counter was opened. It cannot tell you sources, countries or which page was read if you put it on several pages.
If you need real analytics
Move the site to a builder that allows head code, such as Carrd, Webflow, Wix or WordPress, or put Google Sites behind your own domain only for content you do not need to measure.
Frequently asked questions
Will the BYOViral script work in a Google Sites embed?
It will load, but it only sees the sandboxed frame, so the numbers will not reflect your pages. We do not recommend it.
Does the hit counter work on Google Sites?
Yes. It is a plain image, which the embed frame shows normally.
Is the built-in Google Analytics free?
Yes, Google Analytics has a free tier. You need a Google Analytics property and its measurement ID.
Try BYOViral free
Privacy-first analytics with no cookies and a real free tier.
Create your free account →