The first thing you'll want to do once you set up your Search site is fill out your global settings and your locale config, which live in the config > global_config.json file and config > locale_config.json file respectively.
These files come with all Search experiences and are where you specify things that are shared across all pages, like the experienceKey, sdkVersion, favicon, or Google Tag Manager (GTM) ID.
locale_config.json File
Updating the locale_config.json is required in order to get your experience working. Specifically, you will need to update the Experience Key property.
If you are building a single-language experience (which is most common, at least to start), you only need to specify the default locale and the experienceKey to get started. You can ignore the rest of the file unless you're ready to build multi-language experiences.
You can find this experience key by navigating to Search > Your Experience > General Settings. This is how the system knows which search configuration to use when running searches. By default, the system will use the configuration version pinned to the STAGING label in the Staging Environment (typically this will be the "Latest" version) and the version pinned to the PRODUCTION label in the Production Environment.
The locale config contains three main properties. Check out Multi-Language Search Frontend for more info on setting up these properties.
Here's an example of what this file looks like for a single language experience:
{
"default": "en",
"localeConfig": {
"en": {
// "fallback": [""], // allows you to specify locale fallbacks for this locale
// "translationFile": "<filepath>.po", // the filepath for the translation file
// "urlOverride": "", // provide an override for the url path for this locale if you want it to be different than specified in the urlFormat object
"experienceKey": "answers" // the unique key of your search configuration for this locale
}
},
"urlFormat": {
"baseLocale": "{locale}/{pageName}.{pageExt}",
"default": "{pageName}.{pageExt}"
}
}
| Property | Description |
|---|---|
default |
This is the locale code for your experience. This should align with the language code for your entities in the Knowledge Graph. If you're not sure what this is, you can look in Account Settings > Personal Settings and find the Default Language for your account. You can also look at the "Languages" module on Entity Edit. If your account is in the US and you have not enabled multi-language profiles, your default locale should be set to "en". Similarly, if you are in the UK, it should be set to "en_gb". |
localeConfig |
The localeConfig object, most importantly, is where you specify the experienceKey so that the frontend knows which backend configuration to connect with. In the case that you have multiple languages, you have the flexibility to use different experience keys per language. You can learn more about this and the additional properties that you can set here in the Multi-Language Search module. You need a localeConfig for each language in your experience, including the default. |
urlFormat |
This determines the URL format of the pages that are generated. |
global_config.json File
The global_config.json file allows you to specify properties that are shared across the pages and that are not specific to a locale, including things like the sdkVersion or favicon.
You can optionally choose to specify things like the API Key or Business ID, but if you don't specify these (which most people don't) they'll be automatically populated based on the account that you're in.
Here's an example of what this file looks like:
{
"sdkVersion": "1.16", // The version of the Answers SDK to use
// "token": "<REPLACE ME>", // The auth token to access the Search experience
// "apiKey": "<REPLACE ME>", // The answers api key found on the experiences page. This will be provided automatically by the Yext CI system
// "experienceVersion": "<REPLACE ME>", // the Answers Experience version to use for API requests. This will be provided automatically by the Yext CI system
// "environment": "production", // The environment to run on for this Answers Experience. (i.e. 'production' or 'sandbox')
// "cloudRegion": "us", // The cloud region to use for this Answers Experience. (i.e. 'us' or 'eu')
// "cloudChoice": "multi", // The cloud provider to use for this Answers Experience. (i.e. 'multi' or 'gcp')
// "businessId": "<REPLACE ME>", // The business ID of the account. This will be provided automatically by the Yext CI system
// "initializeManually": true, // If true, the experience must be started by calling AnswersExperience.init() or AnswersExperienceFrame.init() for iframe integrations.
// "useJWT": true, // Whether or not to enable JWT. If true, the apiKey will be hidden from the build output and the token must be specified through manual initialization.
// "useGenerativeDirectAnswers": true, // Whether or not to use generative direct answers when applicable
"sessionTrackingEnabled": true, // Whether or not session tracking is enabled for all pages
"analyticsEventsEnabled": true, // Whether or not to submit user interaction analytics events
"logo": "", // The link to the logo for open graph meta tag - og:image.
"favicon": "",
"googleTagManagerName": "dataLayer", // The name of your Google Tag Manager data layer
"googleTagManagerId": "", // The container id associated with your Google Tag Manager container
"googleAnalyticsId": "", // The tracking Id associated with your Google Analytics account
"conversionTrackingEnabled": true // Whether or not conversion tracking is enabled for all pages
}
| Property | Description |
|---|---|
sdkVersion (Required) |
This is the version of the SDK library that you want to use. You can choose to pin to a specific version (e.g., 1.3.1), a minor version (e.g., 1.3 which will use the latest patch version of that minor), or a major version (e.g., 1 — not recommended). The theme will update with the latest version of the SDK so when you upgrade your theme make sure to check this. |
token |
The auth token to access the Search experience. |
apiKey |
Yext will automatically pull the Search API key from your account. But if you want to use another API key, you can enter it here. |
experienceVersion |
The Search Experience version to use for API requests. This will be provided automatically by the Yext CI system. |
environment |
The environment to run on for this Search Experience. ('production' or 'sandbox') |
cloudRegion |
The cloud region to use for this Search Experience. ('us' or 'eu'). You must be on Theme v1.31 or above to set the cloud region. |
cloudChoice |
The cloud provider to use for this Search Experience. ('multi' or 'gcp'). You must be on Theme v1.34.3 or above to set cloud choice. |
businessId |
If you set an API Key from another business, also provide the business ID for authentication. |
initializeManually |
For the runtime config to be used, this toggle needs to be set to true. |
useJWT |
If using the runtime config and requiring a JWT, set this to true to clean the build output of the API key. For more information on JWT, visit the step-by-step guide. |
useGenerativeDirectAnswers |
Enable Generative Answers. |
sessionTrackingEnabled |
Allows you to enable or disable session tracking for all pages. Defaults to enabled — the search session is tracked using session storage and cookies. |
analyticsEventsEnabled |
Whether or not to submit user interaction analytics events. Defaults to enabled. When set to false, this prevents any analytics user events from being submitted. |
logo |
Add a URL or asset reference to the logo you want to use as the thumbnail image whenever the site is shared on social media platforms like Twitter or Facebook. Strongly recommended if you are using the Yext-hosted experience. Not necessary if you are embedding search results on an existing page in your CMS. |
favicon |
Add a URL or asset reference, just like you did for the logo. |
googleTagManagerId and googleTagManagerName
|
Built-in mechanism to add Google Tag Manager to your pages. Provide both your Google Tag Manager Name and your Google Tag Manager ID to make this work. |
googleAnalyticsId |
Enter the tracking ID associated with your Google Analytics account. |
conversionTrackingEnabled |
Allows you to enable or disable conversion tracking for this site. Defaults to enabled. There are additional steps you may need to take, which are outlined later. |