Created
April 14, 2020 09:24
-
-
Save kaesetoast/7086f3a7a665d69936aeb8334774a35b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// check if referrer is outside of the website scope | |
if (document.referrer.indexOf(`${window.location.protocol}//${window.location.host}`) === -1) { | |
window.localStorage.setItem('__fnp_referrer', document.referrer); | |
} | |
const referrerField = document.querySelector('[name="signupform[referrer]"]'); | |
const referrerValue = window.localStorage.getItem('__fnp_referrer'); | |
// write stored referrer value back to hidden field in signup-form | |
if (referrerField && referrerValue) { | |
referrerField.setAttribute('value', referrerValue); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment