javascriptmodel-view-controllertealium

How to check if a user came to site by clicking a specific link?


We have a external website say www.my-mainsite1.com and it has web page which has a link("link to subsite1") to subsite say www.my-subsite1.com.

When a user is on www.my-subsite1.com, how to check the user came by clicking "link to subsite1" on www.my-mainsite.com

We have limitations on using query string to www.my-subsite1.com. So, any suggestions/tools to identify the link clicks?


Solution

  • If you don't want to use a query param, you can use document.referrer property in your website:

    The Document.referrer property returns the URI of the page that linked to this page

    It will show you the origin site of the request, otherwise it will be a blank string if the site was opened directly.

    Example of a site opened from a link:

    enter image description here

    Another one without referrer:

    enter image description here