Where to Put Google Analytics Code in Weebly?
Getting your Weebly website live is a huge first step, but the real work begins when you start trying to understand who's visiting and what they're doing. Google Analytics is the key to unlocking these insights, but the setup can be tricky if you're not sure where to look. This tutorial will walk you through exactly where to put your Google Analytics code in Weebly, step-by-step. We'll cover the two primary methods, how to confirm everything is working correctly, and what your next steps should be once the data starts rolling in.
First Things First: Finding Your Google Analytics Code
Before you can add code to Weebly, you need to know what you’re looking for in Google Analytics. With the shift from Universal Analytics (UA) to Google Analytics 4, the code you need looks a little different. Don't worry, finding it is straightforward.
You'll need two pieces of information from your GA4 account: your Measurement ID and the full Global Site Tag (gtag.js) snippet. Which one you use depends on the method you choose below.
1. Find Your Measurement ID
Your Measurement ID is a unique identifier that tells Google Analytics which account and property to send data to. It always starts with "G-" followed by a series of letters and numbers (e.g., G-XYZ123ABC).
- Log in to your Google Analytics account.
- Click the Admin gear icon in the bottom-left corner.
- In the Property column, make sure you've selected the correct GA4 property for your Weebly site.
- Click on Data Streams.
- Select the data stream for your website. It will likely be named after your site's URL.
- On the next screen, you'll see your Measurement ID in the top-right corner. Go ahead and copy it - you'll need it for the easiest installation method.
2. Get the Full Global Site Tag (gtag.js) Snippet
The Global Site Tag is a small piece of JavaScript that does the actual tracking. You'll need this full snippet if you're on Weebly's free plan or prefer to add the code manually.
- From that same Data Streams page where you found your Measurement ID, scroll down to the section titled View tag instructions.
- Click on the Install manually tab.
- You will see a box with a JavaScript code snippet. This is your Global Site Tag. It starts with
<-- Google tag (gtag.js) -->and ends with</script>.
It will look something like this:
`<-- Google tag (gtag.js) -->,
<script async src="https://www.googletagmanager.com/gtag/js?id=G-YOUR_MEASUREMENT_ID"></script>,
<script> window.dataLayer = window.dataLayer || [], function gtag(){dataLayer.push(arguments)}, gtag('js', new Date()), gtag('config', 'G-YOUR_MEASUREMENT_ID'), </script>`
Now that you have your code, it's time to add it to Weebly.
Method 1: The Easiest Way (Using Weebly’s SEO Settings)
If you are on any of Weebly’s paid plans (Starter, Pro, Business, etc.), you have access to a dedicated field made specifically for Google Analytics. This is the simplest and recommended method, as it prevents any mistakes.
For this method, you only need your Measurement ID (e.g., G-XYZ123ABC).
Step-by-Step Instructions:
- Log in to your Weebly Site Editor.
- From the top menu, click on Settings.
- On the left-hand menu, select SEO.
- Scroll down until you find the section labeled Google Analytics.
- You'll see a text box titled "Tracking Code." This field is a bit misleadingly named - it’s designed only for the Measurement ID, not the full script.
- Paste just your Measurement ID (the one starting with "G-") into this box.
- Click the blue Save button at the bottom-right of the page.
- Finally, click the Publish button in the top-right corner of the editor to make sure your changes go live.
That's it! Weebly automatically adds the entire gtag.js script to every page of your site behind the scenes. You just had to tell it which account to send the data to.
Method 2: Manually Adding the Code to the Site Header
If you're on the free version of Weebly or you simply prefer to add the code yourself, this method is for you. This approach involves adding the full code snippet directly to your site's header, which ensures it loads on every single page.
For this method, you need the complete Global Site Tag (gtag.js) snippet you located earlier.
Step-by-Step Instructions:
- Log in to your Weebly Site Editor.
- From the top menu, click on Settings.
- On the left-hand menu, select SEO.
- Scroll down and locate the section titled Header Code.
- Carefully paste the entire Google Analytics gtag.js script into this box.
- Double-check that you've copied and pasted the complete code, from
<-- Google tag (gtag.js) -->to</script>. - Click the blue Save button.
- Make sure to Publish your site to push the changes live.
One important tip: Do NOT add the code to the "Footer Code" section. While a site will still technically function, placing the analytics script in the header ensures it loads first. If it's in the footer, a user might click away from your page before the script has a chance to load, meaning their visit might not be tracked at all.
Crucially, you should only choose one of these methods. Using both will cause your traffic to be double-counted, which will completely throw off your data.
The Final Check: How to Verify It's Actually Working
Don't just add the code and assume it's working. Spending two minutes to verify the setup now will save you from major headaches later when you realize no data has been collected for weeks.
Here are three simple ways to check:
1. Use the Real-time Report in Google Analytics
This is the most straightforward way to see your code in action.
- Keep your Google Analytics account open in one browser tab. Navigate to Reports > Real-time.
- In a new tab or on your phone, visit your live Weebly website.
- Switch back to the Real-time report in GA4. Within 30 seconds to a minute, you should see yourself register as a visitor on the map and in the "Users in Last 30 Minutes" card. If you see your visit, you’re good to go!
2. View Your Website's Page Source
You can also check your site's underlying code to see if the script is present.
- Go to your live Weebly website.
- Right-click anywhere on the page and select "View Page Source" (the wording may vary slightly depending on your browser).
- A new tab will open with the HTML code of your site.
- Press Ctrl + F (on Windows) or Cmd + F (on Mac) to open a search box.
- Type in your Measurement ID (e.g., G-XYZ123ABC) or "gtag.js". If the search finds your script in the code, you've successfully installed it.
3. Use the Google Tag Assistant Companion
For a more advanced check, you can use a browser extension from Google.
- Install the Tag Assistant Companion from the Chrome Web Store.
- Navigate to your live Weebly website and click the extension's icon. It will analyze the tags on your page and show you if your Google Analytics tag was found and if it's firing correctly.
Troubleshooting Common Issues
Stuck? Here are solutions to a couple of common problems.
- "I'm not seeing myself in the Real-time report." First, be patient, as it can sometimes take a minute or two. Second, clear your browser's cache or try a different browser. Finally, double-check that you clicked both Save and Publish in the Weebly editor. A simple typo in the Measurement ID can also cause this, so copy and paste it again just to be sure.
- "I have an old UA-XXXXXXX code. Should I use that?" No. Universal Analytics was officially phased out in July 2023. You must use the new GA4 Measurement ID (G-XXXXXXX). If you don't have a GA4 property yet, Google Analytics will guide you through creating one when you log in.
Final Thoughts
You have now successfully installed Google Analytics on your Weebly site. By finding your GA4 Measurement ID or Global Site Tag and placing it in either the SEO Settings field (for paid plans) or the Header Code section (for free plans), you have unlocked the ability to track visitors, understand their behavior, and make smarter decisions about your website's content and design.
Connecting your data sources is the first hurdle, but the next is figuring out what to do with all that data. Instead of spending hours digging through Google Analytics reports or trying to combine them with information from other platforms, we built Graphed to do the heavy lifting for you. We let you connect GA, your CRM, ad platforms, and more into one place, then use simple, natural language prompts like "Show me a dashboard of a sales funnel using GA traffic and HubSpot leads" to get instant, live-updating dashboards that answer your most important business questions.
Related Articles
What SEO Tools Work with Google Analytics?
Discover which SEO tools integrate seamlessly with Google Analytics to provide a comprehensive view of your site's performance. Optimize your SEO strategy now!
Looker Studio vs Metabase: Which BI Tool Actually Fits Your Team?
Looker Studio and Metabase both help you turn raw data into dashboards, but they take completely different approaches. This guide breaks down where each tool fits, what they are good at, and which one matches your actual workflow.
How to Create a Photo Album in Meta Business Suite
How to create a photo album in Meta Business Suite — step-by-step guide to organizing Facebook and Instagram photos into albums for your business page.