How to Add Google Analytics and Place a Pixel for Retargeting Ads: A Step-by-Step Tutorial
- Galen Carson
- Jun 16, 2023
- 4 min read

Tracking user behavior and data on your website is vital for running a successful digital business.
With Google Analytics, you can gain valuable insights into web traffic and user behavior. In this step-by-step tutorial tailored for Caram Media clients, we'll guide you through the process of setting up Google Analytics 4 and placing a pixel on your WordPress or Shopify site. By implementing this, you can unlock the power of retargeting ads to follow up with website visitors who have shown interest in your business. Let's get started!
Tracking user behavior and data on your site is imperative to running a successful digital business. Google Analytics is a free data analytics platform that lets you measure all kinds of data related to your web traffic and user behavior on your site — like time on site, bounce rate, and e-commerce revenue — helping you better understand campaign performance so that you can better allocate funds and enable higher ROI. Because of its robust features and comprehensive data collection — and because it’s free — it’s the most widely used service of its kind. However, before you can reap the rewards of this powerful platform, you must properly set it up.
On July 1, 2023, Google Analytics 4 is replacing the Google Analytics we’ve known for more than a decade. This newer version is highly complex but much more powerful than the legacy version.
Think of GA3 as a model home, you walk in and maybe the fixtures and the paint aren’t exactly to your liking, but it functions and will handle all the basic needs. Now, think of GA4 as a home taken down to the studs. You can get it exactly as you need it to your design specifications, but you’ll have to hire a builder, architect, plumber, etc. This is the level of intention it will take to get GA4 set up correctly.
The most important (and complicated) step is the process of administering Google Analytics on your website with common plugins. This step-by-step tutorial will help you launch your tracking by guiding you through the process of creating a Google Analytics 4 account and publishing that pixel on a WordPress or Shopify site.
What Is a Tracking Pixel and What Does It Do?
A tracking pixel is a piece of code that, when embedded on your company-owned websites and apps, can help you evaluate your marketing efforts and increase sales.
A tracking pixel is included in the header of each of your web pages, so that every time a page is loaded, the pixel is triggered and measures the user’s behavior and attributes.
Why Would a Marketer Set Up a Tracking Pixel?
Pixels measure visits, clicks, and other digital behaviors. The more information that is known about customer behaviors on their websites and digital marketing campaigns, the better that marketers can adjust the marketing mix — and spend — for different channels.
What Can a Tracking Pixel Be Used For?
A tracking pixel allows marketers to track events, including email opens, ad impressions, website visits, form fills, transactions, and other digital behaviors. When customers and prospects perform these behaviors, marketers call it a conversion. Tracking pixels can also note the user’s operating system, location, browser type, operating system, and other attributes.
Let’s Get Started!
Step 1: Create a Google Analytics 4 Property
Access your Google Analytics dashboard and click on "Admin" > "Create Account."
Fill in the required property details, including the name, reporting time zone, currency, and website setup information.
Step 2: Create a Data Stream for the Web
In Google Analytics 4, set up a "Data Stream" to collect data across different device types.
Choose the "Web" option and enter your website URL and a recognizable stream name for reporting and analysis purposes.
Step 3: Generate Your Pixel
Depending on your website platform, there are different ways to generate your Google Analytics 4 pixel.
Use suggested plugins or follow manual installation instructions provided by Google Analytics 4.
Your tracking ID will be in the format "UA-XXXXXXXX-X," and your pixel code will include JavaScript tags.
Step 4: Place Your Pixel on WordPress or Shopify
For WordPress:
Install a plugin such as "Header Footer Scripts" to simplify the process, or place the pixel manually.
Access your WordPress backend and navigate to "Appearance" > "Editor" > "header.php."
Locate the closing </head> tag and paste your pixel code above that line.
For Shopify:
Go to your Shopify admin and navigate to "Online Store" > "Preferences."
In the Google Analytics section, click on "Manage pixel here."
Connect your Google account, select the appropriate Measurement ID, and connect your Google Analytics 4 property.
Step 5: Test Your Pixel
Verify that your pixel is working correctly by checking if Google Analytics registers traffic for your site.
Visit builtwith.com and enter your URL to see if Google Analytics is listed under Advertising.
Monitor the data collected by Google Analytics and investigate any unusual spikes or periods without data.
Retargeting Ads Campaigns:
With your Google Analytics and pixel in place, you can leverage retargeting ads to reconnect with website visitors who have shown interest in your business.
Create specific ad campaigns targeting those who have interacted with specific pages, added items to their cart, or initiated checkout.
Use the data collected by Google Analytics to create custom audience segments for more precise targeting.
Craft compelling ad creatives and messages that remind visitors about your products or services and encourage them to take the desired action.
How Can You Tell If Your Tracking Pixel Is Working?
To check that a pixel is working in GA4, you can use the GTM/GA debugger tool. This Chrome extension will allow you to check Google Analytics implementations and the activity you collect from events. This allows you to see in real-time event data and check for the GA4 implementation in your browser. Then return to your analytics or ads manager platform. If the tracking pixel is working, you will see when it was last active (the current date and time for ads), and view your data coming in via the ‘Realtime’ dashboard in GA4.
To Wrap it Up
By setting up Google Analytics and placing a pixel on your website, you have laid the foundation for retargeting ads campaigns. Use the valuable insights and data provided by Google Analytics to reconnect with website visitors who have previously shown interest in your business. Craft compelling retargeting ads to drive conversions and increase ROI.
If you need expert assistance with your website set-up or retargeting ads strategy, contact the web team at Caram Media for a free discovery call. Let us help you enhance your web presence and optimize your retargeting efforts.
Comments