We’ve seen a lot of WordPress users asking how to add Google’s remarketing code to their site to enable Google Analytics’s demographics & interests data in their reports. The remarketing code also gives advertisers more options when setting up AdWords campaigns.
The best Google Analytics plugin for WordPress is the one by Yoast, and we fully recommend you use it on every site you build. We’ll show you how to add Google’s remarketing code using Google Analytics for WordPress by Yoast.
There are other Google Analytics plugins for WordPress that might make this seem easier, but they don’t provide the same functionality that Yoast’s plugin does, nor are they backed by one of the most popular plugin developers in the entire community.
Default Analytics Code
After you’ve activated Google Analytics for WordPress, and connected your web property, you’ll see source code in the
<head> section of your site that looks like this:
The value assigned to the
ga.src variable is what we’ll need to change to enable remarketing & demographics reporting.
Google states that we need to replace the default value of
ga.src with this:
ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';
Host ga.js Locally
- In your WordPress admin, navigate to “Settings” > “Google Analytics”
- Scroll down until you see “Host ga.js locally”
- Check the box, and then enter the following value into the input field:
If your site is loaded securely via https, use https instead. https://stats.g.doubleclick.net/dc.js
- Click the button to update your settings
Because this is an advanced setting, you need to check the box that says “Show advanced settings” in order to see the Host ga.js locally option.
Now view your source code and you should see this:
Enable Remarketing in Google Analytics
Once you have your new code in place, you need to login to Google Analytics, and enable the Remarketing feature.
- Login to your Google Analytics account
- Navigate to the “Admin” area
- Select the Account & Property of your site
- Scroll down until you see Enable Demographics and Interest Reports. It’s under Display Advertiser Features.
- Switch the option to ON, and save your changes
View Demographic & Interest Reports
- Switch over to the Reporting tab in Google Analytics
- In the left menu, open up Audience, and click on one of the options under Demographics or Interests
- It may take a day or two before you start to see data
Demographics & Interests will give you even more data to analyze within your Google Analytics account, and you can set it all up with the most popular Google Analytics plugin for WordPress.
Yoast is currently re-writing his plugin to add support for Universal Analytics. As of Dec 16, 2013, remarketing is not available if you’re using Universal Analytics. You must be using the ga.js analytics code.