Advanced Integration Blog Series Part Two – Conversion Goals
Director of Customer Success Scott here once again with another entry in our Advanced Integration series of posts. If you missed our initial article, take a look at that here as it contains valuable information about tracking your site visitors along with news of our new knowledge base and support system.
Today’s Topic – Event Based Conversion Goals
Many users write in to us asking about Event Conversions. It’s no surprise since it can be a little confusing to set up! Have no fear of Javascript; this guide will walk you through everything you need to know.
What is an Event Based Conversion Goal?
Event Conversions allow you to call our API to fire a conversion pretty much whenever you’d like on your website. You can fire the conversion after a user lands on a specific page, clicks a button, has been on the site for 30+ seconds, has visited 4+ pages, etc. Anything that you can monitor and control with Javascript can be used to fire an Event Conversion. (A few more examples can be found in our API Cookbook.)
You will be required to code the Javascript on your end for specific API calls. We can provide the code that needs to run when you want to add the user to your audience, but we cannot code custom events for your site. Confused? Don’t be! I’m here to walk you through it.
How it Works
First, you’ll need to decide how/when you want your conversion goal to trigger. One of the most common questions I receive is how to fire a conversion based off of a button click, so that’s what I’ll be demonstrating here.
Let’s say I have a simple form on my site that users complete when they want more information on my product. After they click the button to submit the form, they are taken to an automatic download of my trial software. Since there is no landing page for the download, I cannot use a simple Path method to track the conversion. Instead, I can use an Event Conversion and trigger the conversion when the user clicks the button to submit the form!
I’ll create the conversion goal in my Perfect Audience account first. This will let our system know to look for the Event you’re about to set up.
To create an Event Audience, click Manage-> Create Conversion. Give the Conversion goal a name and select the Event method.
In the box, enter a unique tracking name for this conversion. In this example, we’ve used ‘formSubmit’ but this can be whatever you’d like. Just make to use something unique for each conversion you create.
For the Revenue box, enter a dollar amount you want attributed for each conversion. Use this if you have a flat revenue amount for the conversion goal, like $25/per conversion. If your revenue amounts will be unique for each conversion, leave this blank and see below for information about tracking your revenue dynamically. You may also leave this blank if you do not wish to track revenue.
Use the “Count by” setting to determine how we should count the conversion goals.
- “Count every conversion” will count every conversion we see, even if the same user converts multiple times.
- “Count once per order ID” will count one conversion per each unique Order ID you send us (see below).
- “Count once per user” will count only the first time we see a unique user convert; multiple conversions will not be counted.
For my example, I’m only interested in when the user converts the first time, so I’ll select Count once per user.
Click Create Conversion Goal when you’re done.
Next, you’ll need to add some code to your website. This is code In addition to our normal tracking tag you’ve already installed on your site. In my case, I want the conversion to trigger when the submit button is clicked, so I’ll install it to run at that point.. 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', formSubmit, {orderId: "OrderNumber", revenue: Revenue}])</script>
Note: This is an example of how my code looks for my site. You can copy/paste this code as a starting point for your site but you will need to make the following changes:
- The “formSubmit” needs to be changed to the event name you used when setting up the conversion in your account. This is case sensitive!
- “OrderNumber” needs to be changed to whichever variable your site uses for the order ID number of your conversion. This is typically used in ecommerce stores and is optional.
- “Revenue” should be changed to the variable your site uses for the revenue amount of the sale. This is also optional.
You’re all set! You can now use your browser to test if the conversion is working.
Even More Coming Soon!
Thanks for reading our second installment in advanced tracking techniques! We’ll have more fun technical news to announce soon, including a tool to help you manage your account even better than before. If you have any questions about your Event conversions or have a suggestion for another blog post of this nature, please let us know at [email protected]