Remarketing for Google Analytics for WordPress

I had to hack this out on the SwellPath site today so I figured I’d share it. If you’re using the Google Analytics for WordPress plugin for your WordPress site, and you want to enable Remarketing for Google Analytics, you need to tweak one of the plugin’s files.

Change line 1126 of /wp-content/plugins/google-analytics-for-wordpress/googleanalytics.php

from:

$script = ‘ga.js’;

to:

$script = ‘dc.js’;

And then change line 1129 of /wp-content/plugins/google-analytics-for-wordpress/googleanalytics.php

from:

echo “(‘https:’ == document.location.protocol ? ‘https://ssl’ : ‘http://www’) + ‘.google-analytics.com/” . $script . “‘;”;

to:

echo “(‘https:’ == document.location.protocol ? ‘https://’ : ‘http://’) + ‘stats.g.doubleclick.net/” . $script . “‘;”;

Note that if you upgrade the plugin, it’ll probably overwrite these changes. So make sure you upgrade first, or make the changes again after upgrading. That is it. Happy remarketing!

This entry was posted in analytics. Bookmark the permalink.