The event that a tracker sends
GrainQL Tag names the event after the tracker. It changes the name to lowercase and replaces each space with an underscore. A tracker named “Signup Button” sendssignup_button.
The event shows on the Events page under its name, next to the events that your code sends.
To make a click count as a conversion, open the event on the Events page and turn on
Counts as a conversion. Mission Control, Campaigns, Overview, Sessions, and Neo then count it.
Read Mission Control.
Create a tracker with the Visual Picker
The Visual Picker opens your site in a new tab, on top of the live page. GrainQL Tag must be installed on the site.1
Open Events
In the dashboard sidebar, click Events. Then click Track an event.
2
Choose a click
Choose A click on your site.
3
Open your site
Enter the address of your site, for example
example.com. For a local site, add the port.
Then click Open the Visual Picker.4
Click the element
In the new tab, click the element. Enter the event name and confirm. The Visual Picker
suggests a name such as
signup-btn_click.metric tracker with the URL scope contains and the URL of the current page as the pattern.
Create a tracker in Studio
Studio is a page of the dashboard. It shows a snapshot of each page of your site, with the trackers on it.1
Open Studio
In the dashboard sidebar, under Engage, click Studio.
2
Choose a page
In the Pages pane, choose the page. Studio shows its snapshot.
3
Add the tracker
Open the Beans pane. Click Add and enter a CSS selector, for example
#signup-btn.
Or click Pick element from snapshot, then click the element. Studio fills in its XPath.4
Name and save
Enter a name, choose Metric or Conversion, and set the URL scope. Then save.
URL scope
The URL scope limits the pages where a tracker is active.
GrainQL Tag normalizes the page URL and the pattern before it compares them. It removes the
protocol,
www., the query string, and the fragment, and it adds a trailing slash. As a result,
https://www.example.com/pricing?ref=ad and example.com/pricing/ are the same URL.
An equals pattern must hold the domain, because the page URL holds it. The pattern /checkout
never equals example.com/checkout/. A pattern of / alone, or an empty pattern, matches every
page.
The
TrackerDefinition type of @grainql/tag also accepts prefix. The dashboard and the
GrainQL API store only all, contains, and equals.What a tracker stores
How GrainQL Tag runs trackers
- On page load, GrainQL Tag fetches the tracker definitions of your workspace from the GrainQL API.
- For each enabled tracker whose URL scope matches the page, it finds the element and attaches a click listener. It tries the stored fingerprint first and falls back to the CSS or XPath selector.
- GrainQL Tag watches the page for DOM changes. When a matching element appears, for example after a client-side navigation, it attaches the listener again.
- When a click on a link starts a navigation, GrainQL Tag sends the event at once.
TrackerDefinition type in @grainql/tag. When this page and the
type disagree, the type wins.
Delete a tracker
On the Events page, open the event of the tracker and click Delete the click tracker. Then confirm with Delete tracker. GrainQL Tag stops sending the event. The events that it already sent stay in your data.Rules for trackers
- Use a specific selector.
#checkout-btnmatches one element..btnmatches every button. - Name the tracker after the element and the action, for example “Hero CTA click”. The name becomes the event name.
- Do not rename a tracker that has data. The new name sends a new event name.
- If you want the journey that leads to a click, create a track with the event as the goal. Read Tracks.
What trackers do not do
- A tracker does not record what the visitor typed or the content of a form.
- A tracker does not count on pages where GrainQL Tag is not installed.
- A tracker does not send your own properties. For that, call
track. Read Track an event.