Setting Context by Referrer URL

Hi Team,

My client is wanting to be able to update certain CTAs / card layout based on the referrer URL a user is searching from. As an example, they’re wondering if a user runs a search for a “Funeral Director” from a certain URL then the branch name that displays on the corresponding card (see screenshot below), can link through to a different URL? Is this possible through setting context based on the referrer URL?

Currently the branch name just links through to the Yext-powered branch page, but the goal is for it to link to a different Yext-powered intent page instead.

They might actually want the branch name to continue to link to the branch page but instead for a new CTA to appear linking to the intent page. This is to be confirmed but I firstly just want to understand if any of this is possible. Thanks!

Hi Scott,

It’s currently not possible to change card content using query rules. However, you are able to change with entities surface in the results. Similar to this Community post, you could create a separate entity for each scenario and surface the correct entity using query rules based on referrer URL or context.

Would it be possible to use a boolean KG field for the conditional logic? If so, you could set the URL to one link if the boolean is true and another if false. Additionally, this post walks through how to show a third CTA only if a boolean field is true.

Hope this helps!

Hi Kristy,

Thanks for coming back to me here. Regarding changing the entities surfaced based on query rules, would we be able to hide these separate entities completely unless the referrer URL was set to what the query rule was setup for?

So only if the referrer URL was set to what the query rule is setup for, we’d show the separate entities. If the referrer URL is something different we’d just return the current entity set. I guess we could rely on advanced filters for this, but I’m not sure if the separate entities need to be in the same advanced filter as the current ones. Ideally we’d have two different advanced filters and we’d use the referrer URL query rule to determine the one to reference.

It might just make more sense to create a completely new vertical instead of trying to add logic to the existing “Funeral Directors” one, but just trying to think through options.

Hey Scott,

Yes that is doable! An important concept to keep in mind is that the ADD_FILTER query rule action will add the filter on top of any existing filters. This means that any results that are not returned without the query rule will not be returned with it (a workaround here is to boost the entities). Since you are using two separate results sets that do not overlap, I’d recommend you don’t use a saved filter for the vertical itself and use two query rules to add filters: return Advanced Filter A if URL is https://www.domain.com and return Advanced Filter B if URL is not https://www.domain.com.

The other thing to consider is that when there are no relevant results, the default setup is to return all results for that vertical. If you do not want to return all results, I’d recommend turning that feature off.

Creating a new vertical could be another option! Keep in mind that users coming from https://www.domain.com would then be able to see both result sets.