Google Analytics Guide

How to Add Google Analytics to Your Website

Adding Google Analytics is the same job on every platform. Only the place you paste changes. What matters is checking it works and making sure it is installed only once.

Updated 23 November 2026 10 minute read

How to add Google Analytics to your website, on any platform

To add Google Analytics to your website, you give your platform one ID: the G- measurement ID from your Analytics web stream. Copy your measurement ID, which starts with G-, from Admin, Data streams in Analytics. On Squarespace and Wix you paste it into a settings field. On Shopify you connect your property through the Google & YouTube sales channel instead. On WordPress a plugin such as Google's own Site Kit does the work. Any other site takes Google's tag code in the head of every page. Tag Manager users add a Google tag in their container instead. Before you start, check the site does not already carry a tag, because a second copy is the commonest fault and inflates every figure.

Your routeDeveloper tools, External API keys

Paste the ID into the Google Analytics account number field and click Save. Squarespace says statistics can take up to 24 hours to appear.

Routes from Google's list of builders with native integrations, the platform help pages and Site Kit's plugin page, all listed under Sources. Each route is spelled out step by step below.

Three routes

The same tag, three ways in

1

Builder setting

Give the G- measurement ID to the Analytics setting, app or plugin your platform provides. The platform adds the tag to every page for you.

Simplest
2

Google Tag Manager

If the site already uses Tag Manager, add a Google tag there with your ID. Useful when several tags need managing in one place.

Most flexible
3

Code in the head

Paste the full Google tag, which begins with a "Google tag (gtag.js)" comment, into the head of every page. Ask your developer if you cannot edit the HTML.

Custom sites

Pick one route only. If you paste the ID into your builder and also add the code by hand, every page view is sent twice. The figures look healthy and are wrong. If you have not created the property yet, start with how to set up Google Analytics 4.

Source: Set up Analytics for a website and/or app; Google Analytics account structure, checked 23 November 2026. The warning about double installs is our experience.

Check first

Find out whether your site already has a tag

Many sites already carry a tag from a former designer, an old theme or a plugin that was switched on years ago. Spend five minutes looking before you add anything, using any of these three checks.

  1. Search the page source

    Open your home page in Chrome, press Ctrl+U to view the source, then press Ctrl+F and search for gtag, G-, GTM- and UA-.

  2. Run Tag Assistant

    Go to tagassistant.google.com, click Add domain, enter your full address and click Connect. Every tag ID found on the page appears under the Google tags found header.

  3. Watch the Network tab

    In Chrome, open Developer Tools, choose the Network tab and refresh. Requests to googletagmanager.com mean a Google tag is firing. Requests to google-analytics.com or analytics.google.com mean Analytics is receiving hits.

A G- ID that matches your property

Analytics is already installed. Do not add it again. Go straight to the checks further down.

A G- ID you do not recognise

It sends to someone else's property, often a former supplier's. Ask them to add you as an administrator. Otherwise remove it and install your own.

A UA- ID

This is Universal Analytics, the older version that GA4 replaced. Squarespace tells owners to swap an old ID for the GA4 measurement ID. Remove the old tag wherever it sits.

A GTM- ID

The site runs Google Tag Manager. Add Analytics inside that container rather than through a second route.

The same G- ID twice

It is installed twice, so every page view counts double. Remove one copy, usually the hand-pasted one.

Tag Assistant and Network tab checks from Google's Set up the Google tag with gtag.js, last updated 6 November 2026; the UA advice from Squarespace Help, Connect Google Analytics to your site. What to do with each finding is our method.

Step by step

Where the Analytics setting is on each platform

Start in Analytics on every platform. Go to Admin, then under Data collection and modification click Data streams, open your web stream and copy the measurement ID from Stream details. Then follow the card for your platform.

Squarespace

  1. Open the Developer tools panel.
  2. Click External API keys.
  3. Paste the ID into the Google Analytics account number field.
  4. Click Save.

Squarespace says statistics can take up to 24 hours to appear. Its help page names no plan requirement for this field. Code injection, which you do not need here, is limited to the Core, Plus and Advanced plans and some legacy plans. Squarespace also warns that version 7.0 sites using Ajax loading record only the first page of each visit until Ajax loading is turned off.

Wix

  1. Open Marketing Integrations in your site's dashboard.
  2. Click View under Google Tag.
  3. Click Add Google Tag ID and paste your G- ID.
  4. Save, then run the checks further down.

Wix needs an upgraded plan and a connected domain before marketing integrations work, so a free Wix site cannot use this route. Wix also says to avoid installing Google Tag and Google Tag Manager together, as they may conflict.

Shopify

  1. Install the Google & YouTube sales channel from the Shopify App Store.
  2. Follow its Google Analytics setup and connect your GA4 property. Shopify points to Google's guide, Shopify: Set up your Google tag, for the remaining screens.
  3. Turn off private mode for your online store.

Shopify connects Analytics through this channel rather than an ID field. The channel is free to install. Analytics cannot track events until private mode is off. Once connected, certain ecommerce events are tracked automatically, so do not paste the tag into your theme as well.

WordPress

  1. Go to Plugins, Add New and search for Site Kit by Google.
  2. Install and activate it.
  3. Open the Site Kit menu and follow the setup, signing in with the Google account that can see your Analytics property.
  4. Connect Analytics during setup. You can also do it later under Site Kit, Settings.

Site Kit is Google's own plugin and appears in Google's list of native integrations. It needs WordPress 5.2 or later and PHP 7.4 or later. The site must be public, not in maintenance mode or behind a password. Use one plugin only. If your theme or another plugin already adds a tag, turn that off first.

Sources: Squarespace, Connect Google Analytics to your site and Customize parts of your site with code injection, both updated 20 November 2026; Wix, About Marketing Integrations and Google Tag Unification; Shopify Help, Setting up Google Analytics 4 and the Google & YouTube app listing; Site Kit by Google on WordPress.org, all checked 23 November 2026. Turning off a second tag first is our experience.

Other routes

Adding it through Tag Manager or by hand

In Google Tag Manager

  1. Go to tagmanager.google.com and open your site's container.
  2. In the Workspace tab, go to Tags and click New.
  3. Name the tag, choose Google tag as the tag type and enter your G- ID.
  4. Under Triggering, choose a trigger that fires on every page, then save.
  5. Click Preview, enter your website address and click Connect to watch the tag fire in Tag Assistant.
  6. Click Submit, choose Publish and Create Version, then click Publish.

Nothing reaches your site until you publish. The container snippet itself must already be on every page. With Tag Manager in place you do not add gtag.js code to the site as well.

Code in the head

  1. In Analytics, go to Admin, Data streams and click your web stream.
  2. Under Google tag, click View tag instructions, then choose Install manually.
  3. Copy the whole snippet, from the line beginning <!-- Google tag (gtag.js) --> to the closing </script>.
  4. Paste it immediately after the opening <head> tag on every page.

On a custom site this usually means one shared header file or template, so a single paste reaches every page. If you cannot edit the HTML, Google suggests asking your web developer. On a builder without an ID field, Google says to use the builder's custom HTML feature instead.

Sources: Analytics Help, Set up Analytics for a website and/or app; Tag Manager Help, Set up Google Analytics events in Tag Manager, for the Tags, Preview and Publish screens; Google for Developers, Tagging for Google Analytics, which confirms the old GA4 Configuration tag is now the Google tag. Using a shared header file is our experience.

Prove it works

Check it once, properly

  1. Open the Realtime report in Analytics.
  2. Visit your site on your phone with mobile data, not office wifi. Stay logged out of your website editor.
  3. You should appear within minutes. Google says collection can take up to 30 minutes to begin. Squarespace allows up to 24 hours.
  4. Open two pages and check Realtime shows two page views, not four.
  5. Visit a landing page outside your main menu and check it appears too.

If nothing appears in Realtime

  • Check the ID on the site matches the one in your web stream, character for character.
  • Check your cookie banner. If you declined analytics cookies in your own browser, your visit will not show.
  • On Shopify, check private mode is off. On Wix, check the plan is upgraded and the domain connected.
  • On WordPress, check the site is not in maintenance mode or behind a password.
  • Run Tag Assistant again. If it finds no tag, the install did not save or publish.

Collection can take up to 30 minutes to begin, per Set up Analytics for a website and/or app; Realtime confirms data, per Confirm that you're collecting data; the 24 hours and logged-in visits from Squarespace's help page. The double-count test and fault list are our method.

UK law

The Data (Use and Access) Act 2025 changed the UK cookie rules. The ICO says it lets you set some cookies without consent, such as those used to collect statistics to improve your website. The ICO's guidance sets strict conditions for that exception. If you cannot meet them, you need consent before Analytics sets cookies.

No consent needed only if
  • The sole purpose is statistics to improve your site
  • Visitors get clear information and a simple, free way to object
  • Any provider acts only for you, as a processor
Consent still needed for
  • Advertising and remarketing features
  • Anything that does not meet every condition

Sources: ICO, The Data (Use and Access) Act 2025: what does it mean for organisations?, updated 19 June 2026; ICO, What are the exceptions?, updated 29 April 2026. A summary, not legal advice.

Using it

What to do after Google Analytics is installed

Once Analytics is installed, mark your enquiries as key events so you can see which visits lead to contact. On a hosted builder, connecting Analytics in Squarespace settings takes one field and covers every page. Do not add the code a second time through code injection. Once data is arriving, set up those key events using how to set up goals and conversions in GA4.

Our Analytics installation for Bedford businesses always ends with the five checks above. If data still does not appear, see why Google Analytics is not tracking data. More guides are in our Google Analytics guide.

Sources

  1. Analytics Help, Set up Analytics for a website and/or app, checked 23 November 2026.
  2. Analytics Help, Google Analytics account structure, checked 19 November 2026.
  3. Analytics Help, Confirm that you're collecting data, checked 23 November 2026.
  4. Squarespace Help Center, Connect Google Analytics to your site, updated 20 November 2026.
  5. Squarespace Help Center, Customize parts of your site with code injection, updated 20 November 2026.
  6. Wix Help Center, About Marketing Integrations, checked 23 November 2026.
  7. Wix Help Center, Google Tag Unification, checked 23 November 2026.
  8. Shopify Help Center, Setting up Google Analytics 4, checked 23 November 2026.
  9. Shopify App Store, Google & YouTube, checked 23 November 2026.
  10. WordPress.org, Site Kit by Google, checked 23 November 2026.
  11. Google for Developers, Set up the Google tag with gtag.js, updated 6 November 2026.
  12. Google for Developers, Tagging for Google Analytics, updated 25 March 2026.
  13. Tag Manager Help, Set up Google Analytics events in Tag Manager, checked 23 November 2026.
  14. Information Commissioner's Office, The Data (Use and Access) Act 2025: what does it mean for organisations?, updated 19 June 2026.
  15. Information Commissioner's Office, What are the exceptions?, updated 29 April 2026.

Andrew Odgers, Director
Andrew is the director of Lillian Purge in Bedford. He wrote this guide because the most common Analytics fault we find is a tag installed twice. Read more about Andrew. Published 17 August 2026, updated 23 November 2026.

Related guides

Want it installed and checked?

Send us your website address. We will check your tag is installed once on every page and sends to the right place.