Cookies on a Yext-hosted Answers Experience

Hi,

I’m curious if you can provide more information on Cookies and Answers. More specifically, how do cookie settings applied on client’s main site apply to the Yext subdomain?

Hi Lisa,

I think there might be two separate concerns here (one related to cookies being passed between domains, and the other related to cookie preferences) – I’ve attempted to answer both, but if you’re just concerned about one vs. the other feel free to pick!

Background

Third Party vs. First Party Cookies

“A cookie is associated with a domain. If this domain is the same as the domain of the page you are on, the cookie is called a first-party cookie . If the domain is different, it is a third-party cookie” (MDN). Certain browsers (Firefox and more recently Safari) will by default block third party cookies for privacy reasons.

How Do These Types of Cookies Impact Answers

As you’re aware, many analytics providers rely on cookies for tracking. In certain cases, it’s important that cookies set via an external analytics provider are preserved when a user navigates to the Answers experience.

Does Answers Use Cookies?

To get great analytics, Answers uses session cookies and sessionStorage to associate distinct events to the same user within a session. When a user enters your Answers experience on your home page, the Answers JS library will tag that user with a sessionId. This tag will only persist so long as the user’s browser is open.

Questions

Q: When a cookie is set on a client’s main domain, what happens when they move to the answers subdomain?

A: If the Answers experience is hosted on a subdomain (answers.brand.com), any cookies associated with the client’s main domain (brand.com) will be considered a first party cookie on the subdomain and should therefore be preserved / accessible as the user navigates between domains. Note that any cookies must be set at the root of the client’s domain, rather than a subdomain. For example, if your site is brand.com, and your cookies are set at www.brand.com, they will not be preserved on the subdomain.

Q: If a user opts out of cookies on client’s domain, will those preferences be respected when they visit the answers subdomain?

A: If the client has a banner that requires accepting or rejecting the use of cookies, the Answers SDK has hooks to prevent the usage of sessionStorage and session cookies dynamically. This does require some custom development work on the client’s side (to tap into that hook) – happy to follow up with instructions here if needed. It’s also possible to opt out of sessionStorage and session cookies entirely from the get-go via the sessionTrackingEnabled attribute, which can be added the global config json file.

Thanks,
Rose

1 Like

Hi Rose,

if a client decides to deactivate session cookies via the sessionTrackingEnabled attribute, how will this impact analytics in detail? I assume, there is still a search log, but which parts will be missing across Overview, Search Logs, Search Terms and maybe other parts of the platform?

Thanks,
Armin

Hi Armin,

Welcome to the community!

Yes, there will still be a search log, however the number of sessions will increase artificially, which impacts the search terms and the search logs themselves (since a search will not be linked to a session).

Thanks,
Rose

Hi Rose!! Thanks for a great explanation – Can you elaborate on steps Yext and the client would need to take to tap into the hooks that prevent the usage of session Storage and session cookies dynamically, when a client already has the accept/reject cookies banner?

Thank you!

1 Like

Hi @roser and team! Is there any public-facing documentation on the hooks a client can implement to disable the usage of cookies? I would like to share with a client for their reference.

Thanks!

Hi! Thanks for this helpful post. Is there a way to disable only specific cookies? I am looking to disable just the session_id and ypfc cookies. Any guidance would be appreciated!

Thanks,
Sherman

Hi Sherman,

The ypfc is used by conversion tracking. If you disable conversion tracking via the conversionTrackingEnabled boolean in your global config json, that cookie should be removed.

sessionTrackingEnabled only controls the session_id session cookie being set, so if you set that to false, you should no longer see the session_id being set.

Thanks,
Rose

Hi Max, here’s a guide we recently released on this topic! Introduction | Hitchhikers

1 Like

Hi Ariana, noted below but here’s a guide we released on this functionality, Introduction | Hitchhikers

Hi @roser ,

We setup Answers on an experience for a client using a subdomain and then reverse proxied this into their site. We have tried to have their CMP call the AnswersExperience.runtimeConfig.set(“sessionTrackingEnabled”, true) from this guide however this does not seem to be firing correctly. Is this still feasible using a reverse proxy on a site or would we need to do something more custom?

Thanks!

Hey Tripp! Could you confirm the site is on theme 1.23 or later (you can find this in the top level package.json file in the site’s repository)? If it’s on an earlier version of the theme, you’ll need to upgrade in order to get this functionality.