Working with Knowledge Tags
Our Knowledge Tags feature lets you bring the power of schema to your webpage. Use schema from Yext to prime your webpage for the intelligent services of the future. Don’t waste time creating schema that conforms to Schema.org’s standards when we can do it for you quickly and automatically.

Knowledge Tags basics


Knowledge Tags have three main features:
  • Schema: Add perfect, always up-to-date schema to a webpage for a location or person.
  • Knowledge Sync: Sync the content on a website with the Yext Knowledge Engine so that the visible content stays current.
  • Analytics: Pull basic website analytics from a webpage into Yext Analytics.
You can implement Knowledge Tags in minutes by following the steps below.

Get started

KnowledgeTags1
1. In the Yext platform, go to the “Knowledge Tags” page (Pages > Knowledge Tags), and click Add Knowledge Tags to Website.

KnowledgeTags2
2. You’ll be prompted with a large dialogue box. Simply follow the flow to add Knowledge Tags to your page and keep your content in sync with Yext.

KnowledgeTags3
3. Click More Fields to see all of the fields that you have access to. You can also copy and paste the code for each field by clicking directly on the embed code!

KnowledgeTags4

Scan your page

1. To scan your page, click Scan URL.

KnowledgeTags5
2. You’ll be prompted to enter a URL that you would like to scan. Once that’s done, we’ll inform you of whether or not your schema was correctly installed and which schema was found.

View your pages

To see the pages on which you’ve used Knowledge Tags, refer to the bottom of the “Knowledge Tags” page:

KnowledgeTags7
You can observe websites on which we’ve received activity—meaning that a user viewed that page with Knowledge Tags active—and the date on which we received that last activity. If the date is further behind than you expect, you should check in on that website! Also, you can scan that page easily with the Scan URL button in that row.

Knowledge Tags for developers

While Knowledge Tags are meant to be simple for anyone to set up, we’ve included a number of advanced features to make it easy for developers to customize the implementation to meet on their needs.

Script tag

Let’s start with the the script tag. Putting the script tag in your page’s markup is the first step in setting up Knowledge Tags.
<script async defer src="https://knowledgetags.yextpages.net/embed?key=<SECRET_KEY>&account_id=7654321&location_id=<LOCATION_ID>" type="text/javascript"></script>

The script tag contains the following parameters:

SECRET_KEY
The secret key is only used to enable the Knowledge Tags JavaScript implementation. It does not function as a typical API key found in your Developer Console and CANNOT be used interchangeably with those keys. This secret key can ONLY be found in the Knowledge Tags section of the Yext platform.

LOCATION_ID
The location ID (called “Store ID” in the Yext Platform) identifies the location whose data is included in the schema. You can easily replace this ID dynamically; you do not need to go back to the Yext platform and copy a new script tag. When you change the LOCATION_ID on a webpage, the script will automatically update.

ACCOUNT_ID
The account ID is the ID of the account. For regular accounts, this value does not change. If you are using the Partner Portal, the ACCOUNT_ID is the ID that can be found in the “Yext Customer ID” column in the Partner Portal, corresponding to a particular client.

Embed tags

Embed tags allow you to update visible content on the page with content from the Yext Knowledge Engine. Think of it as using the Yext Knowledge Engine as your webpage CMS. To retrieve data from Yext, set the value of data-yext-field to the appropriate field. See the example for the Business Address field below:
<span data-yext-field="address1"></span>

The list below shows the fields currently available in Knowledge Tags. Note that not all fields work on spans; make sure you use the correct HTML tag for each field.
  • Business Name
    • Name of your location in the Knowledge Engine
    • data-yext-field value – locationName
    • HTML tag – span
    • Embed tag – <span data-yext-field="locationName"></span>
  • Logo
    • The logo image for your location
    • data-yext-field value – logo.url
    • HTML tag – img
    • Embed tag – <img data-yext-field="logo.url"></img>
  • Store ID
    • The Store ID of your location
    • data-yext-field value – id
    • HTML tag – span
    • Embed tag – <span data-yext-field="id"></span>
  • Business Description
    • A short description of your location
    • data-yext-field value – description
    • HTML tag – span
    • Embed tag – <span data-yext-field="description"></span>
  • Contact Email
    • The main email address for your business
    • data-yext-field value – email
    • HTML tag – span
    • Embed tag – <span data-yext-field="email"></span>
  • Business Address
    • The street address of your locations
    • data-yext-field value – address1
    • HTML tag – span
    • Embed tag – <span data-yext-field="address1"></span>
  • Business Floor / Suite / Unit
    • The floor, suite, or unit of the building where you location can be found (if applicable)
    • data-yext-field value – address2
    • HTML tag – span
    • Embed tag – <span data-yext-field="address2"></span>
  • Business City
    • The city or locality your location is in
    • data-yext-field value – city
    • HTML tag – span
    • Embed tag – <span data-yext-field="city"></span>
  • Business State
    • The state or region your location is in
    • data-yext-field value – state
    • HTML tag – span
    • Embed tag – <span data-yext-field="state"></span>
  • Business Postal Code
    • The postal code for your location (applies to US locations only)
    • data-yext-field value – zip
    • HTML tag – span
    • Embed tag – <span data-yext-field="zip"></span>
  • Business Country
    • The country code (two-character ISO 3166-1) of the location’s country
    • data-yext-field value – countryCode
    • HTML tag – span
    • Embed tag – <span data-yext-field="countryCode"></span>
  • Business Phone
    • The phone number for your location
    • data-yext-field value – phone
    • HTML tag – a
    • Embed tag – <span data-yext-field="phone"></span>
  • Payment Methods
    • A comma-separated list of payment methods accepted at your location
    • data-yext-field value – paymentOptions
    • HTML tag – span
    • Embed tag – <span data-yext-field="paymentOptions"></span>
  • Business Hours
    • Hours of operation, for all days (e.g., “Monday through Friday, 9 AM – 6 PM”)
    • data-yext-field value – hours
    • HTML tag – div
    • Embed tag – <span data-yext-field="hours"></span>
  • Business Hours
    • Hours of operation, for a particular day of the week (e.g., “Sunday 10 AM – 4 PM”)
    • data-yext-field value – hours-<day>
    • HTML tag – span
    • Example embed tag – <span data-yext-field="hours-Monday"></span>
  • Google Places link
    • Google Places link for your location, titled “Get Directions”
    • data-yext-field value – get-directions-link
    • HTML tag – a
    • Embed tag – <span data-yext-field="get-directions-link"></span>

Styling Tags

Use CSS to style the tags on your page. None of the Knowledge Tags have CSS associated with them, so if you have already styled your page, replacing static content with embed codes should not affect your site’s appearance.

Server-Side Tags

Knowledge Tags use JavaScript to dynamically replace the content client-side and are designed to render very quickly with little to no flicker. However, if you want to implement Knowledge Tags on the server side, you can use our Live API directly. For more information on the Live API, see our Using the Live API guide.

Multiple locations on a single page

You will mostly likely use Knowledge Tags on a single location page. If you have a page that shows information about multiple locations, you will need to add markup for each location. You can easily do so by adding multiple location_Id values to the script tag:
<script async defer src="https://knowledgetags.yextpages.net/embed?key=<API_KEY>&location_id=<STORE_ID1>&location_id=<STORE_ID2>" type="text/javascript"></script>

When providing additional location_Id values, make sure each of your tags also includes a data-yext-location-id property that specifies which location’s data should be used in the tag:
<span data-yext-field="address1" data-yext-location-id="123456"></span>

Schema manipulation

If you want to make manual adjustments to the schema after the fact, you can use our Schema API directly. The Schema API is a server-side API that returns a JSON schema object. It is up to you to add this JSON-LD object to the webpage once you retrieve it, but adding it allows you to manipulate the JSON in order to customize it exactly how you want it. While doing so may be useful in some situations, changing the schema is generally not recommended. Knowledge Tags schema will be updated automatically as schema definitions change, so you should not assume that the JSON-LD object you put directly into your page’s markup will remain current over time. For more information on the Schema API endpoint, see the Live API documentation.

Analytics

By default, page views will be tracked automatically when you add the Knowledge Tags script to a webpage. Additionally, the number of times users click or tap “Call” or “Get Directions” on a location’s page will also automatically be tracked if you use the standard corresponding embed codes. 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", "LOCATION_ID")
If you want to call the standard events (“Get Directions” or “Phone Call”) via the JavaScript library, use the following event names:

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

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

More about Knowledge Tags

For more information about Knowledge Tags, watch our video tutorial series.

Knowledge Tags and Knowledge Sync



Schema API



Knowledge Tags and WordPress