How to use Perfect Audience with Google Tag Manager and Turbolinks

Was this helpful? Share it!

    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:

    1. Go to “Tags” in GTM and click “New”.
    2. 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).
    3. Under “Fire On”, select the custom trigger you’ve created to fire on virtual page changes.
    4. 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 “”.

    Was this helpful? Share it!
      No votes yet.
      Please wait...
      Voting is currently disabled, data maintenance in progress.

      Leave a Reply

      Your email address will not be published. Required fields are marked *