Draft: ATC/Current/SDK/Types of tracking
{{Article |Standalone=No |DisplayName=Types of tracked data |TocName=Types of tracked data |Context=Learn about the different data you can track using the SDK. |Dimension=Journey, SDK |ComingSoon=No |Platform=GenesysCloud |Section=
Contents
Types of tracked data
Track viewed pages
The pageview method tracks the webpages that your visitors view. To send a pageview, call the ac function and pass pageview as the first argument.
ac('pageview');
Track custom events
The record method allows you to track custom events, usually as a result of a person interacting with an element or control in your website. For example, the click of a button.
The record method takes two parameters:
- The name of the event to record as a string. Note: See #mintydocs_link must be called from a MintyDocs-enabled page (Draft:ATC/Current/SDK/Types of tracking)..
- An (optional) key-value hash of properties for the event.
- An (optional) callback function that invokes when the request is completed.
- An (optional) callback timeout, in milliseconds, to configure how long to wait when the event takes too long to complete. This option is useful to capture events (such as file downloads) before navigating to a different page/URL, ensuring that the visitor is always redirected.
ac('record', 'section_opened');
You can also provide extra metadata with your custom event:
ac('record', 'button_clicked', {
companyName: 'Acme Inc,',
employees: '100-500'
});
The following code sample shows how to record a file download and navigate to the file URL /files/pricing.pdf when capturing the event, or after 400 milliseconds:
ac('record', 'file.downloaded', {
name: 'Pricing',
fileType: 'pdf'
}, function () {
navigateTo('/files/pricing.pdf');
}, 400);
Guidelines for custom event names
- Must be less than 255 characters; we recommend keeping them short and descriptive
- Can contain any combination of alphanumeric characters, underscores, or hyphens only
Examples of custom event names include:
- "detected_errors"
- "section_failed"
- "section_submitted"
- "product_added"
- "product_removed"
- "address_selected"