Store Console.Log as Variable in Javascript

I am trying to capture an adobe experience ID that is loaded when the site load. I was hoping to log the ID and then pass it to a variable then pass that to a hidden field on a form. I have the code below, but it comes up as undefined for the variable when passing. I’m aware that the variable isn’t defined because I guess you can’t store a variable as console.log. Any advice would be greatly appreciated.

<script>
  
var a = console.log(_satellite.getVar("Experience Cloud ID"));

  
 window.onload = function() {
      console.log(a);
   document.getElementById("tfa_1").value = a;
      };

  
  
</script>

45 thoughts on “Store Console.Log as Variable in Javascript”

  1. 870203 161894An interesting discussion is worth comment. I do feel which you really should write read much more about this subject, it will not be considered a taboo subject but normally every person is too couple of to communicate in on such topics. To another. Cheers 662963

    Reply

Leave a Comment