Google Analytics lets you see how many people visit your website, where they come from, and what pages they look at. Setting it up takes about ten minutes and works the same basic way whether your site runs on WordPress or was built as a plain HTML site.
Step 1: Create a Google Analytics Account
- Go to analytics.google.com and sign in with a Google account. Use one your business controls, not a personal account you might lose access to later.
- Click Start measuring and enter an account name, such as your business name.
- Enter a property name (usually your website's name), pick your time zone and currency, then click Next.
- Fill in a few basic details about your business and click Create.
Step 2: Get Your Tracking Code
- When asked how you want to collect data, choose Web.
- Enter your website's URL and a stream name, then click Create stream.
- You'll now see a Measurement ID starting with "G-". Copy it, you'll need it in the next step.
Save your Measurement ID somewhere safe. You'll need it again if you ever redesign your website or move it to a new platform.
Step 3: Add the Tracking Code to Your Website
How you add the code depends on how your website was built.
If Your Website Runs on WordPress
- Install a plugin that supports adding tracking or header scripts (many SEO plugins include this option).
- Open the plugin's settings and paste in your Measurement ID or the full tracking snippet, depending on what the plugin asks for.
- Save the settings. The plugin will add the tracking code to every page for you, so you won't need to touch any theme files directly.
If Your Website Is Plain HTML or a Custom-Built Site
- In Google Analytics, copy the full tracking snippet shown under Tagging Instructions (it starts with a
<script>tag). - Open your website's files using the File Manager in your hosting control panel, or connect using FTP.
- Paste the snippet just before the closing
</head>tag on every page you want to track, or in a shared header file if your site uses one. - Save the file, and upload it back to your server if you edited a local copy.
Step 4: Confirm It's Working
- Open your website in a browser.
- In Google Analytics, go to Reports, then Realtime.
- You should see your own visit appear within a minute or two. If nothing shows up, double check the Measurement ID and confirm the tracking code is actually on the page by viewing the page source and searching for "G-".
It can take up to 24 hours for Google Analytics to start showing full reports beyond the Realtime view. That delay is normal, give it a day before assuming something is wrong.
Once analytics is running, pairing it with some basic on-page SEO work will help you get more out of the data you're collecting. See our guide on on-page SEO basics for a good next step.