3 Replies Latest reply on Aug 16, 2017 3:58 PM by Sanford Whiteman

    Get Form name from Forms 2.0 API?

    Ja Shia

      Is it possible to get the form name (the name that is in Marketo) by using the form ID and the Forms 2.0 API? For example:

       

      MktoForms2.loadForm("//app-sj14.marketo.com", "xxx-xxx-xxx", 2146, function(form){

      var name;

      name = form.name;

      return name;

      });

       

      Any thoughts would be appreciated?

        • Re: Get Form name from Forms 2.0 API?
          Sanford Whiteman

          Is it possible to get the form name (the name that is in Marketo) by using the form ID and the Forms 2.0 API? For example:

          Officially, no.

           

          You can access the name from the descriptor if you manually load it as discussed in my blog post: http://blog.teknkl.com/smoothing-embedded-marketo-form-loads/

           

          However, note the name (unlike the ID) is not unique over time. I'm also not sure what you're trying to do with this information, since Marketo already makes the form name known as {{trigger.name}}.

            • Re: Get Form name from Forms 2.0 API?
              Ja Shia

              Hi Sanford,

               

              Thank you for your response. I want to capture the name as a variable and send it over to Google Analytics through GTM for tracking purposes. When you say, {{trigger.name}}, what do you mean? Is this something like form.trigger.name?

               

               

              Sorry if this is silly question, but what's a short example that accesses the form name using the Forms API?

                • Re: Get Form name from Forms 2.0 API?
                  Sanford Whiteman

                  {{trigger.}} tokens can be used in Flows. They can't be used from the client side, though, so you could only supply them to GA if you logged using a webhook (not a bad idea given the additional context you can provide).

                   

                  I'll answer your question on my blog if you leave a comment there. It's really far from supported stuff so I don't think it should be directly on the Nation.