AnsweredAssumed Answered

save a var into a hidden form field

Question asked by 4273ee9393fc05f192467296025976d75acfc2af on Aug 6, 2016
Latest reply on Aug 6, 2016 by sanford.whiteman

Hello,

 

I am having trouble with saving the google cliend id (cid) into a hidden field. I am able to get the cid, get it written out in an alert, in a var and as a string, but the last step to save it is taunting me...

 

Is there someone here who have done this and can tell me where I am messing it up? (I have double checked that the form field name is correctly written)

Please, I already shaves my head but I'm going bold here!!

 

<script>MktoForms2.loadForm("//app-lon02.marketo.com", "***-***-***", ****, function(form) {

  function getgacid() {

              try {

                var tracker = ga.getAll()[0];

                return tracker.get('clientId');

              } catch (e) {

                return 'n/a';

              }

            }

  var gacid = getgacid();

  var cid = gacid.toString();

  form.vals({"SE_OS_40":"cid", 'SE_OS_50':cid});

    alert("Funkar! cid= " + getgacid() + "& " + gacid + " & cid :" + cid);

        });

      </script>

Outcomes