Event Audiences

Use the "event" Audience method to add users to an Audience when they perform an action triggering a specific javascript event on your site. This method requires knowledge of javascript and the ability to write some custom code for your website. 

Here's a few examples of why you might want to use an Event Audience:

  • Track users who click a button
  • Track users of only a root domain, i.e. www.yoursite.com homepage visitors
  • Track users who are on your site for X seconds
To create an Event Audience, first head to Manage-> Create Audience


Give the Audience a name, set a duration, and select the Event method.


In the box, enter a unique tracking name for this Audience. In this example, we've used 'audience' but this can be whatever you'd like. Save the Audience when you're done.

Next, you'll need to add some code to your website. In addition to our normal tracking tag you've already installed on your site, you'll want this code to run when you want to add the user to the audience (on page load, button click, etc.):

<script type="text/javascript">
window._pq = window._pq || [];
_pq.push(['track', 'audience'])
</script>

Note that 'audience' needs to match whichever tracking name you gave the Audience in your Dashboard.

That's it! When the code runs, the user will be added to the Audience.

Note: We're happy to provide some examples here, and while we provide extensive support over e-mail for all aspects of Perfect Audience, we cannot debug or write Javascript for you outside of the examples provided.

For more detailed info about our javascript tracking API, click here for the documentation. We also have a list of use more cases with example code here: Tracking API Cookbook


Feedback and Knowledge Base