Event tracking is an important aspect of web analytics. Pageviews can only tell part of the story, so we send and analyze events to understand how users interact with the pages they are on. This reduces the amount of speculation when it comes to enhancing websites.

What is an Event Intent?

Events aren’t always black and white! Some events don’t necessarily indicate the user did what was reported, others may not actually capture an important conversion. These grey areas can mislead insights one way or another, so it’s imperative to squeeze out as much information as possible from the context clues.

Some events that imply various intents include:

Copying text — did the user copy a URL or an Email address? This intent won’t be captured by a standard click tracker.

Contextual Menu — when the user right (or middle) clicks on a link they have options to save the file or open in a new tab. This intent also won’t be captured by a standard click tracker, but it also does not imply they even did anything at all.

Mailto links — A mailto link is the start of a funnel, not the end. This is not as solid of a conversion as a form submission.

Printing — Likewise, opening the print dialog does not mean the user actually did anything further.

Click-to-Call — This link generally opens the keypad, but does not always trigger the call.

Tracking these events are still important, but it is even better to denote that they are only intents, so when making insights the additional information can help mold the decisions. This method also allows for more accurate conversion goal reporting (intents may or may not be important conversion factors).

Assigning Custom Dimensions in Google Analytics

In Google Analytics, navigate to the Admin tab. Under the Property column, click “Custom Definitions” then “Custom Dimensions”.

A free Google Analytics account provides 20 available custom dimensions. Premium level accounts allow up to 200 custom dimensions. Each dimension has an index and a scope that we need in order to send the dimension along with the event. For more information about dimension scopes, refer to the Google Analytics documentation.

Click “New Custom Dimension” at the top of the page. Name this dimension “Event Intent”. The scope should be “Hit”, and make sure the Active checkbox is checked. After saving, be sure to note down the index string provided. It will look something like “dimension3″.

Setting and Sending the Custom Dimension with the Event

Now that the custom dimension is defined and assigned an index, we can now listen for event intents from our users. It is important to note that custom dimensions must be set prior to sending a hittype (pageview or event)!

Note for the following code snippets, I will be using “dimension3” as my custom dimension index. Be sure to update it to your own custom dimension index!

Click Intent

Using jQuery, you may be used to using either .click() or .on('click') to detect clicks. For intents, we’ll need to use a different listener: mousedown . Mousedown passes a button number to the function that we can use as our context clue. Standard click is 1, middle click is 2, and the contextual menu is 3; therefore, we can simply listen for a mouse button greater than 1. Our code would look something like this:

JavaScript

Copy Intent

To listen for important text being copied we’ll use a combination of jQuery and regex.

JavaScript

Print Intent

Listening for print intent can be done with the following JavaScript:

JavaScript

Each project may have additional events that can be associated with an intent. During user experience testing you should be able to find various alternative methods that are within this grey area.

Reporting using Event Intent

Use the “Top Events” report within Google Analytics (located in the Reporting tab under Behavior > Events) to see your events and their associated event intents. Find and click the event category to assess, then add a Secondary Dimension of Event Intent to see which were an Intent and which were Explicit.

Applying Event Intent to Conversion Goals

Create a segment that either includes or excludes the Intent custom definition (using the Advanced Conditions is the segment creation process). Then when viewing conversion reports, this segment can be applied or added to see a comparison between conversion intents and explicit conversions.