How do I create events in HubSpot?

Last updated: June 20, 2017

Available For:

Marketing: Enterprise
Sales: N/A

What is an event?

An event is a feature available for Marketing Enterprise HubSpot customers that allows you to track when a user performs a specific action on your website. Common examples include:

  • A visitor signed up for trial
  • A visitor downloaded a whitepaper
  • The free demo button was clicked
  • A user logged in
  • A prospect created an account
  • The pricing page was viewed

What do I need to get started?

  • The Events tool is only available to customers on the Enterprise package.
  • The HubSpot tracking code must be installed on any page that you wish to track events on.

How do I create an event?

  • In your HubSpot Marketing account, navigate to Reports > Events > Click on the button to 'Create new event'.
  • Choose your event type:

What are the Event Types?

Visited URL Event

visited URL events
Enter the exact URL that when visited, will trigger the visited URL event.
  • Add tag(s) to organize your events.

If you're using SSL, you will want to keep protocols in mind (http versus https) - if you want to track a URL that utilizes SSL and contains "https" within said URL, you will want to make sure you write "https" here.

Note: You can also use wildcards in the URL to have the event fire for a range of pages. For example, using * at the end of a URL will allow the event to fire on any pages that contain the first part of the URL. For example, if all of your blog URLs begin with you can use* to fire the event for all of the blog URLs. This means that the event would fire for pages like,, etc.

Clicked Element Event

We recommend using the Events Bookmarklet to generate clicked element events, see more instructions about this setup. Otherwise, you can manually create a clicked element event using an id, class, or jQuery selector.

Clicked element event
Clicked element event
  • Enter the ID, Class, or a jQuery selector for the element on your website page that you want to track clicks on. Ex. if you had an image on your page with this HTML <img id="webinar-offer-image" src="/webinar-march.png"/> the ID would be webinar-offer-image.
  • Specify a page URL that will limit the Event to only triggering for visitors that click on the element on that specific URL. If you want this event to fire on all page, leave the page URL blank.
  • Associate a conversion value that will appear in your event report if you want to measure the return of an investment with this event.
  • Add tag(s) to organize your events.

Submitted Form Event

submitted form event
submitted form event
  • Select the HubSpot form that you want to trigger the event. Forms that are submitted to HubSpot via the Forms API are also included in the dropdown list of forms.
  • Specify a page URL that will limit the event to only triggering for visitors that submit the form on that page. If you want this event to fire on all page, leave the page URL blank.
  • Add tag(s) to organize your events.


Custom Events

Creating custom events requires a developer to write custom JavaScript to submit an event to HubSpot when certain conditions are met. The API documentation for creating custom events is available on the Developers forum. There are two types of custom events: Custom JavaScript events and HTTP API events.

  • Custom JavaScript Events

When a page is loaded and the HubSpot tracking code is executed, we create a variable _hsq which acts as a queue that you can push tracking events onto. You can add events to be tracked by setting the variable _hsq to an array and filling it with event calls. You can call methods by specifying the method name and arguments, ex. _hsq.push(["method", "arg1", "arg2"]); Variables should correspond to Contact property keys in order for their values to appear correctly in Contacts' records.

Custom JavaScript event
Custom JavaScript event
  • Add your JavaScript code to create your custom event. The JavaScript will automatically be included whenever your HubSpot tracking code is loaded.
  • Specify a page URL that will limit the event to only triggering for visitors that visit that page. If you want this event to fire on all page, leave the page URL blank.
  • Add tag(s) to organize your events.
  • Custom Events using the HTTP API

You can also track an event by hitting the URL provided when creating a custom HTTP API Event. The Events tool will provide a URL that contains various query parameters. Requests against '' should be made using GET (both HTTP and HTTPS are supported).

HTTP API event
To trigger an HTTP API event, you must make a request to our tracking API with the path /v1/ event.
  • The two required parameters are: "_n"(the Event's unique identifier ) and "email" (the email address of the Contact that triggered the event).
  • To generate your event's id: click on the button in the Event to 'Create Report' > click to View the saved event > Edit Event > click the link to Use the HTTP API. The id will now be included as a parameter within the request URL.

    HTTP API event with id

Was this article helpful?