Step 4: Track Additional Analytics

Overview

By default, page view tracking is off per the Analytics Settings section on the Knowledge Tags implementation screen. To add page view tracking, you will need to enable the pixel (you can choose “Always On” or “Per-user Opt-In”) and add the script tag to a webpage.

pages tracking pixel

Additionally, the number of times a user clicks or taps “Call” or “Get Directions” on a page will also automatically be tracked if you use the corresponding embed codes.

Track Additional Events

To track more events, you can use our JavaScript library directly. To trigger an event through your own JavaScript, follow the model below: Yext.customEvent('EVENT_NAME', "entity_id")

If you want to call the standard events (e.g., “Get Directions” or “Phone Call”) via the JavaScript library, use the following event names:

GET_DIRECTIONS

Yext.customEvent("GET_DIRECTIONS", "entity_id")

TAP_TO_CALL

Yext.customEvent("TAP_TO_CALL", "entity_id")

For example, to track analytics for a button click for an entity with the Entity ID of 815, your script tag would look like this:

<script>
function buttonClickFunc(){
Yext.customEvent('button_clicked', "815")
}
</script>
<a onclick="buttonClickFunc()">Click me!</a>