Event Audiences

Use the "event" Audience method to add users to an Audience when they perform an action that triggers 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 are a few examples of when to use an Event Audience:

  • Track users who click a button
  • Track users of a subdomain, i.e. shop.yoursite.com visitors
  • Track users who are on your site for X seconds

To create an Event Audience, first click 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.