Step 4: Configure the JS Snippet for Your Analytics Platform (Optional for Approach 1)

As noted at the end of Step 1, this step is optional. This step should be followed (in addition to Step 1) if you have custom analytics (like Adobe) that are hosted on your domain and will also be added to Search.

If you’re using an analytics platform that relies on first party cookies, you might risk losing those cookies when a user enters the Yext iFrame. In order to make sure those cookies are properly preserved between the Yext iFrame and the page, you’ll need to set up a subdomain of your main domain, and CNAME that subdomain over to our Yext hosting environment. This will make the iFrame a first-party iFrame, allowing the iFrame to access cookies set by your main domain.

1. Confirm Cookies Are Set at Root of Main Domain

Make sure any cookies are set at the root of your main domain, rather than a subdomain. For example, if your site is yourdomain.com, and your cookies are set at www.yourdomain.com, the iFrame will not be able to access them.

2. Set Up a Subdomain for the iFrame

To make sure that the cookies are set at the same domain, you’ll create a subdomain from which to host your search experience.

A. Choose a subdomain

This subdomain will be where Yext hosts the search experience. Since this domain will not be consumer facing, the naming of the domain is not important, but we’d recommend something like search.mydomain.com.

B. Create a CNAME record

Create a CNAME record pointed to mysubdomain.mydomain.com.pagescdn.com..

  • Be sure to include the subdomain in its entirety. For example, if you selected search.mydomain.com, then your CNAME will point to search.mydomain.com.pagescdn.com.
  • Note the trailing dot (.) - it is required by the DNS specification when setting up a CNAME to another domain (pagescdn.com, in this case). Some DNS providers may handle this automatically; your IT team will know how to configure the record correctly.
  • If you have an internal DNS, make sure to set up the CNAME record there, too (mysubdomain.mydomain.com pointed to mysubdomain.mydomain.com.pagescdn.com.), otherwise the subdomain will not display on your internal network.

If you are hosting your data in the EU cloud region, point the CNAME record to mysubdomain.mydomain.com.eu.pagescdn.com. instead. For example, if you selected search.mydomain.com, then your CNAME will point to search.mydomain.com.eu.pagescdn.com.

C. Let us know which subdomain you’ve selected.

We will perform a few tests and confirm the configuration is active. Please note, no content will appear until we’ve deployed your site to our production environment. Prior to launch you may see an error message stating that no content is present.

3. Add the Search Experience to the Search Page

You’ll follow the same instructions to add the search page here , however the production URL will be the domain you selected above. For example, if you selected search.mydomain.com, you’ll add:

<html>
  <head></head>
  <body>
    <header></header>
    <div id="answers-container"></div>
    <script src="search.mydomain.com/iframe.js"></script>
    <footer></footer>
  </body>
</html>
Feedback