Events - Visits the URL
Create the Event
To track that people have viewed a certain page, grab the URL of the page and name the event something easy to remember.
Some examples include:
- The URL of a landing page
- The payment confirmation page of a checkout process
- The URL of your pricing page
- A URL to download a key document of yours
- The final page of any funnel on your site
If you want to track every page view, you can enable it in your JavaScript settings.
Wildcards
You can also record visits to similar URLs under one event name. Use *
to indicate wildcards.
For example, let’s say you’re giving out beta invites to your site. All of the URLs are generated according to a pattern, like:
yourdomain.com/beta/TIC04tRF9Y
yourdomain.com/beta/89rrPNMWsD
You could record visits to yourdomain.com/beta/*/
, which encompasses all of these similar URLs. Please refer to Wildcards for more examples.
Partial URLs
Rather than typing in the domain of your site every time, you can use partial URLs. Here are some examples:
https://yourdomain.com/plans
is the same as/plans
http://yourdomain.com/reports/*
is the same as/reports/*
To clarify, a partial URL is the entire part of the URL that follows the domain.
Don’t forget about that initial /
!
Tracking Different Subdomains
However, if you do want to differentiate different subdomains, we can support that too! Please verify in your site’s JavaScript Settings that the option for Include URL Host and Subdomain (Event Library) is enabled. This lets our Event Manager differentiate events that occur on similar URLs:
https://sub1.yourdomain.com/foo
https://sub2.yourdomain.com/foo
https://sub3.yourdomain.com/foo
This option is enabled by default.
Query Strings
The Event Manager can differentiate between two query strings
, (the ends of some URLs that start with ?
). That is, you can safely set up these events to be different from each other:
Event 1 = [http://yourdomain.com/foo.html?id=1](http://yourdomain.com/foo.html?id=1)
Event 2 = [http://yourdomain.com/foo.html?id=2](http://yourdomain.com/foo.html?id=2)
(In this example, we detect the difference between ?id=1
and ?id=2
though they’re on the same page /foo.html
.)
Technical Notes
Note
Our Event Manager URL detection has difficulty with hash symbols
#
in the URL. Consider placing record calls from our JavaScript Library on the pages you wish to track, especially if you are using backbone.js.
Testing
To quickly test your URL pattern without creating an event, you can open up your browser’s JavaScript console and run KM.um(pattern)
, where pattern
is your URL pattern:
> KM.um("/beta/*");
true
Updated about 2 years ago