If logic not working
Situation: I have created a 6 page micorsite for lead generation. The site has the ability to take in lead source variables that we pass through and I was looking to add in a backup as we have seen some gaps recently with this variable. To fix the issue, I added in some JS to capture the tracking tag from a link and pass it through all the pages until they hit submit on the form. To do this I had to add in an if statement to only fill the variable if it is empty/null/undefined, but my logic isnt working and its repopulating on every page. From what I can tell the IF itself isnt wrong, but when I search in the consol for the variable it doesnt appear, although it does in the AC debug mode. If the IF thinks the variableis empty, this would make sense why it is updating it constantly, but I cant figure out why its reading the variable that way. Any idea what I am doing wrong?
JS (fires onload):
function updateTrackingTag() {
var TrackingTag = document.controller.getValue('/ctx/vars/trackingtag');
if (TrackingTag !== "" || TrackingTag !== undefined || TrackingTag !== null) {
document.controller.setValue('/ctx/vars/trackingtag', TrackingTag);}
else {
document.controller.setValue('/ctx/vars/trackingtag', location.search);}
}