Can we capture the referred URL in custom database?

Hi there,

I want to capture the referral URL in the database when user clicks on SUBMIT button, is that possible if yes how? Btw, I’m using this code but its not working for me.

$w.onReady(function () {
  // Get the referrer URL
  var referrerURL = document.referrer;

  // Set the referrer URL in the hidden field on the form
  $w("#refferalLink").value = referrerURL;
});

Hi there,

You should be able to access the referrer address using the Wix-Window-Frontend.

To accomplish this, import the API and use wixWindowFrontend.referrer.

Here’s an example of how it is used:

import wixWindowFrontend from 'wix-window-frontend';

// ...

let referrer = wixWindowFrontend.referrer;  // "http://somesite.com"
1 Like