Ongoing 20% off promo on Squarespace. Expires December 20, 2024. Learn more.
website builder cheat sheet

Choose the best website builder for your business

The Cheat Sheet that shows you exactly which website builder to choose based on your needs with bonus on how to get free custom domain, free email hosting, and more.

Get the FREE cheat sheet
website builder cheat sheet

How to add Google Analytics 4 to Weebly

By David NgeLast Updated: January 25, 2023

My work is supported by affiliate commissions. Learn More

Here's a step-by-step tutorial on how to add Google Analytics 4 or any other tracking codes in Weebly.

In this guide, we'll go over:

You will be able to successfully implement Google Analytics code in Weebly by the end of this tutorial.

Let's dive right in.

Where to find your Google Analytics tracking code

First, login to your Google Analytics account.

Sign in to Google Analytics
Sign in to Google Analytics

This step assumes you have created a Google Analytics Property for your site, if not then follow Google's documentation here.

In your Analytics dashboard, select Admin.

Head over to the Google Analytics Admin dashboard
Head over to the Google Analytics Admin dashboard

Then in your Admin dashboard, select Tracking Info ➞ Tracking Code.

Select tracking code from the admin dashboard
Select tracking code from the admin dashboard

Can't locate the Tracking Code?

Does your admin dashboard look different? There's a good chance you're using Google Analytics 4.

Skip ahead to retrieve the tracking code from Google Analytics 4.


Copy the highlighted code.

Copy the Google Analytics Tracking code
Copy the Google Analytics Tracking code

Important: Make sure you copy the entire tracking code which is about 8-9 lines of code.

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=XXXXXXXXXX"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'XXXXXXXXXX');
</script>
Dummy Google Analytics Code (Do not copy)

Now head over to the next section to add the tracking code to your Weebly account.

Get tracking code from Google Analytics 4

In your Analytics dashboard, select Admin.

Head over to Google Analytics 4 admin
Head over to Google Analytics 4 admin

Then in your Admin dashboard, select Data Streams.

Select Data Streams from the admin dashboard
Select Data Streams from the admin dashboard

Select your website.

Select your website
Select your website

Expand the drop down menu for Global Site Tag.

Select the Global Site Tag
Select the Global Site Tag

You will then see your Google Analytics tracking code. Click the Copy icon.

Copy the Google Analytics 4 tracking code
Copy the Google Analytics 4 tracking code

Now head over to your Weebly account.

Adding Google Analytics code to Weebly

First login to your Weebly account. Make sure you select the correct website and click Edit Site.

Select the right Weebly site to edit
Select the right Weebly site to edit

Head over to the Settings page.

Head over to the settings page
Head over to the settings page

Then click on the SEO tab.

Head to the SEO tab
Head to the SEO tab

The SEO tab is where you add tracking codes such as Google Analytics, Facebook Pixel, or any other third party code.

You can also hide your Weebly website from Google search and redirect any of the pages within the SEO settings page.


Add the Google Analytics code under Footer Code and click Save.

Paste your Google Analytics tracking code in Footer
Paste your Google Analytics tracking code in Footer and click Save

Publish the website to make the changes live.

Publish the website to live the changes
Publish the website to live the changes

That's it! You should see some user data in your Analytic dashboard after 24 hours.

Adding any third party tracking code in Weebly

You're not limited to adding Google Analytics code in Weebly. You can add other popular codes too, such as Facebook or Google Pixel, Google Webmaster tool verification code, heatmap tracking tracking code, etc.

Just make sure you're adding the code right after one another:

//Adding multiple tracking codes 

<script>
	Google Analytics Code
</script>

<script>
	Facebook Pixel
</script>

<script>
	Other third party codes
</script>

Note: Each tracking code is enclosed by the script tag (<script> ... </script>).

You will notice there are 2 areas in which you can add the Google Analytics Code (or any other tracking codes for that matter):

  1. Header
  2. The Footer
You can add tracking code in Weebly's Header or Footer
You can add tracking code in Weebly's Header or Footer

Adding code the in the header means the tracking code will sit at the top of the page.

The benefit of adding the code at the top of page means your tracking code will load first when a user visits the page.

It's recommended that you add important tracking codes at the top of page (Header) when you're tracking important metrics such as tracking ad revenue from Facebook or Google Pixel.

However, adding the tracking code at the top of page could also potentially increases the page loading time and make the user experience worse. This is something to consider when you're adding tracking codes you're not familiar with.

Conversely, adding tracking code at the bottom of the page (Footer) means the tracking code will load after the page is shown to the user, which is what users usually prefer.

It's recommended to place non-critical tracking code at the bottom of the page instead.

David Nge

David is the founder of MakingThatWebsite.com and started making websites for businesses back in 2014. He's a keen learner and wants to share his journey and knowledge with other business owners and freelancers. He launched MakingThatWebsite.com in 2021 to make website building more approachable and scalable for businesses.

Have a tutorial you want to learn? Leave a suggestion here.