How to Place a Google Analytics Pixel

By August 2, 2017Uncategorized

Google Analytics is a free platform build by Google that lets you measure your advertising return on investment (ROI) as well as track your Flash, video, and social networking sites and applications. It’s the most widely used web analytics service on the internet, and for good reason. However, before you can reap the rewards of such a powerful platform, there is one major step you have to take: Placing a Google Analytics Pixel on your site.

To help you launch your tracking, we’ll cover some fundamentals around pixels and scripts around Shopify and WordPress.

Key Definitions:

  • Pixel: Pixel-based tracking is the process of using a 1X1 pixel transparent gif to track a visit or event on a web page, ad impressions on social, the opening of an email, and much more. On web pages, pixel tracking is an alternative to javascript tracking. For the sake of this training, we will use the word pixel generally to talk about everything we would place for tracking.
  • Javascript: An object-oriented computer programming language commonly used to create interactive effects within web browsers.
  • Script: A scripting or script language is a programming language that supports scripts: programs written for a special run-time environment that automates the execution of tasks that could alternatively be executed one-by-one by a human operator. Scripting languages are often interpreted (rather than compiled).
  • Header: <head> is the beginning of your header. The header contains scripts, pixels, and javascript that loads elements on your website. The majority of pixels/scripts will be placed in your header. You can access your header in your index.liquid files on Shopify, or your header.php file on WordPress. It’s closed with the following: </head>.
  • Plugins: Some plugins help in pixel placement. For WordPress, the header footer scripts plugin comes in very handy because it allows you to place pixels/scripts on individual pages, like thank you pages.
  • Events: Events are specific codes placed to track specific page activities. For example, you could track add to carts, leads, checkout started, checkout completed and more.

Placing Your Google Analytics Pixel:

For the Google Analytics Pixel tutorial, we will use be using a test pixel. To find to your pixel, log in to your Google Analytics account, set up the account using Google’s setup wizard, and generate the code. You should get the code on one of your final screens. Here is the process for implementation!

Step 1: Generate your pixel:

Here is where you would generate your pixel:

Hawke Media Google Analytics Pixel Placement 1Your tracking ID can also be used to easily place into Shopify:

Your tracking ID should look something like this:  UA-44148842-1

Here is our pixel:

<script>

(function(i,s,o,g,r,a,m){i[‘GoogleAnalyticsObject’]=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,’script’,’https://www.google-analytics.com/analytics.js’,’ga’); ga(‘create’, ‘UA-94046338-1’, ‘auto’); ga(‘send’, ‘pageview’);

</script>

Step 2: Place the Pixel:

For WordPress, you will need to place your base pixel in the header of your site, just before </head>.  To place it, log in to your site, and locate your header file. To access this, go to Appearance > Editor > header.php.  Sometimes it will be labeled as something else, but you will always see header.php. Next, find the closing </head> and place it just above that code. Here is an example of where it would go:

Hawke Media Google Analytics Pixel Tutorial_2.png

On Shopify, it’s a bit easier. Simply add it to your online store preferences shown below:

Hawke Media Google Analytics Pixel Tutorial 3

Step 3: Test Your Pixel

The easiest way to test it is within GA. Simply check back in a few minutes and see if there has been any traffic on your site. You can also go to builtwith.com and check by typing in your URL, and scrolling down to Advertising. If it worked, you would see GA in there.

After you’ve set up your Google Analytics account, you’ll want to learn how to read your data. Get started with our guide to organic social media in Google Analytics. Check back shortly for a tutorial on how to place pixels for Facebook!


Take your marketing to the next level. Access Hawke Media’s July White Paper: The Power of Search Engine Marketing.

© 2017 | All rights reserved Hawke Media.