You built your website with a job to do. Every design element was meticulously chosen. Every page and post is carefully written. You’re here to grow your business or expand the impact of your nonprofit and your website is the key to making it happen.
One of the best ways to make sure your site is getting the job done right is to track and measure what is working. This extends beyond just your site to include the various way people get to your site. While Google Analytics remains one of the best ways to find out what people are doing on your site, the tracking codes provided by other resources such as Facebook are much better at tracking the effectiveness of your ads and posts.
Integrating tracking codes is not hard. However, a site with a job to do has many parts and you need to carefully manage which tracking codes appear where without complicating your workflow. This post is going to tell you all about how to include tracking codes and pixels in a WordPress site.
Tracking Codes and Pixels 101
A tracking code (also called a “tracking pixel” or simply a “pixel”) is a smallish string of HTML that usually sits in the header of a webpage. When someone visits that page the tracking code gathers information such as how they got to the page and what they clicked on when they are there. The magic happens when the tracking code reports that information back to you in charts and graphs summarizing what people are doing so you can make decisions about what to add or take away from your site.
“Why should I use a tracking code? Doesn’t Google Analytics tell me everything about who visited my site, how they got there, and what pages are most important?”
Yes, all true, but tracking codes are a bit more exciting. Facebook is a great example of this, and a resource I am sure many of you are using today. By combining their tracking reports specifically on the behavior of people that have found your sitethrough Facebook. Whether it’s a paid ad, or your Facebook business page, the Facebook pixel tells you which of your posts matter most.
This functionality exists for many of the resources that folks use to grow their businesses online. So even though this post will talk about using a Facebook tracking code, you can apply the same steps for the other places you may be using to grow you web traffic.
How To Add a Tracking Code to WordPress Correctly
A tracking code can easily be added by copying from the provider and pasting in between the <head> and </head> tags. That starts to break down when you are using several tracking codes from different providers and need to get them onto every single page. Thankfully, this is WordPress, so there is an easier way to get this done that doesn’t require code editing.
Enter the tracking code manager. There are many different ones to choose from, but the most popular (for good reason) is one creatively named Insert Headers and Footers. It installs just like every other WordPress plugin, so brush up on that process here if you’ve forgotten.
After installing Insert Headers and Footers, it will appear under the Settings menu of your WordPress Dashboard.
Insert Headers and Footers is not much more complicated than a nice copy and paste flow. The key is in the added functionality. Start by getting the tracking code you want to add. This is going to vary by the provider so check with their knowledge base for the correct steps.
One quick note that could quickly become a point of confusion. Many tracking code providers may offer to connect with a “Tag Manager” or the like. Don’t let this confuse you. These types of integrations are typically with enterprise scale managers that are used by giant online retailers. Whichever tracking code you are using, make sure you are copying and pasting the code.
With your tracking code handy, add it to all the headers on your site by going to Settings > Insert Headers and Footers. From here you’ll be brought to a screen that shows you the scrips currently in the header ( <head> ) and above the </body> tag. The Scripts in Header text box is where you’ll want to paste your tracking code. Be careful not to interrupt any other scripts you have in the <head>. As you can see from my screenshot, I have a Google Analytics script in the header already. Make sure your new script is pasted below the last </script> tag.
Adding Tracking Codes in the Genesis Framework (ATTN: Evermore Customers)
I wrote about some great features of the Genesis Framework for WordPress in a previous post. If you are using Genesis, adding a tracking code requires no additional plugin. By the way, if you are an Evermore customer, we’ve already got you on the Genesis Framework so this applies to you. The best practices and steps above are 100% the same with the exception of the steps needed to add a plugin. Copy your code, click the Genesis tab in the WordPress left-hand nav and go to Theme Settings. From there, scroll all the way down until you see the Header Scripts and Footer Scripts textboxes. Paste your code in the Header Scripts textbox after the last </script> tag (ignore this if there are none) and hit Save Changes. Here’s what it should look like:
Tracking codes are a great resource provided by companies like Facebook and Instagram to measure how people are getting from your social posts to your website. It’s best to put tracking codes in the header of every page which can get really annoying if you are trying to do it manually for an entire site. Tracking code managers help by allowing you to paste the code once and have it end up everywhere you need it to be.
The WordPress plugin called Insert Headers and Footers allows you to easily post scripts to headers and footers across your page. Tracking which posts are getting people to your site and whether or not they are doing what you want when they get there (hopefully spending money) is key to building a site that grows your business or nonprofit. Use this post to make the most of your social feeds, and as always, have fun!
- Remove “This Site May Be Hacked” From Your WordPress Website’s Search Result
- How to Accept Recurring Payments and Donations with PayPal Using Gravity Forms
- How to Sell Products with Gravity Forms
- How to Sell Your First Product with WooCommerce
- How to Use Pods with WordPress to Build a Team Member Page
- How to Create Custom Sidebars for Genesis Themes
- How to Add Tracking Codes and Pixels to WordPress
- Google Grants for Nonprofits