We have a web application project that uses Google Tag Manager (GTM) and Ruby on Rails. As a result, we also use Turbolinks. We found that, even with a custom trigger properly configured (read about that in this article), Perfect Audience would only fire the first time we loaded a page, and not for subsequent page views.
Here’s the trick: Don’t use the Perfect Audience tag provided by Google Tag Manager. Instead, create a custom one. Here are the steps:
- Go to “Tags” in GTM and click “New”.
- Select “Custom HTML Tag” and paste the javascript code that Perfect Audience provides you with (go to “Manage > User Tracking” in your Perfect Audience account to get this).
- Under “Fire On”, select the custom trigger you’ve created to fire on virtual page changes.
- Save your changes and be sure to Publish!
Once you’ve completed these steps, you can verify that it’s working. Visit your web app in Chrome or any other browser with a developer console. With each page change, you should see network activity to a server with the hostname “prfct.com”.