ss

Don't call a Marketo LP an “External URL” even if it sort-of-works

SanfordWhiteman
Level 10 - Community Moderator
Level 10 - Community Moderator

When choosing a Thank You/Follow Up URL, Form Editor presents 3 largely self-explanatory options:

ss

Choosing Landing Page will give you a nice dropdown of all your approved Marketo LPs.

Choosing External URL and entering the full URL of a Marketo LP seems to work, too — but it's a bad move. Form Editor won't tell you why, but I will.

The problem

If you choose Landing Page or Stay on Page, Marketo uses a special read-your-write feature to ensure Pre-Fill on the next pageview.[1]

If you choose External URL, Marketo looks up the URL in your known LPs but it doesn't look in your Redirect Rules.  If the URL is not seen as a core LP URL, even if it does lead to a Marketo LP in reality, then the read-your-write Pre-Fill cache is not enabled.

What is “read-your-write” and why should I care?

“Read-your-write” or RYW is a desirable, but not always supported, feature of distributed systems. (A distributed system is any system that processes data at multiple tiers, like we all know Marketo does.)

RYW, in a nutshell, means:

If a user thinks they've made a change to the back end, then show them the new data as if it's been fully saved, regardless of whether system(s) may be still filtering and processing — or even discarding! — the data in the background.

It doesn't mean anybody else sees uncommitted data (there are some cases in which it won't be saved, so you don't want to propagate bad info more widely than necessary).

It means that for a less confusing user experience, you let a user see their own requested update immediately, instead of forcing them to see older saved data for a few seconds/minutes (even though showing saved data would technically be more accurate end-to-end).

Marketo implements read-your-write via the special query parameter aliId. It's a numeric identifier for a set of submitted form values, and it's usable regardless of whether the values are actually saved. When a page has an aliId in the URL, it's capable of (for the most potent example) filling a second form using the data from a first form, even if it was submitted mere milliseconds before.

Back to Form Editor

When you choose External URL in Form Editor, Marketo tries to append the aliId intelligently, but it can't know about your redirects (especially 3rd-party redirects) or anything that might disguise the Marketo-ness of the destination URL.  As a result, the next LP someone views may show their session's old data (maybe including someone else's email) or no data at all (the session still being effectively anonymous). You don't want that! So choose Landing Page if it's indeed a Marketo LP.

Other complications

When you use the Forms JS API onSuccess method to choose a Thank You URL dynamically (a very powerful option) set the form to Stay on Page in Form Editor, as this will ensure the aliId is appended.

Then clip out and append the original query string, which will include the aliId, to the dynamic URL.

A quick-and-dirty way to append the original query is like so:

MktoForms2.whenReady(function(form){

  form.onSuccess(function(vals,tyURLFromFormEditor){

    var originalThankYouDoc = document.createElement("a");

    originalThankYouDoc.href = tyURLFromFormEditor;

   

    var dynamicThankYouURL = "https://pages.example.com/other-marketo-lp.html" +

      originalThankYouDoc.search;

   

    document.location.href = dynamicThankYouURL;

    return false;

  });

});

If you're using a fuller-featured URI parser/builder already, like uri.js, use that instead of the Link/Location method (though the location.search breakdown works perfectly, since it's a key browser function).

Just don't write your own parser… I don't want to have to holler at you again!


NOTES

[1] When you use Stay on Page the aliId is attached even if you're using the form embed and the page is a non-Marketo page. It's not fully honored in this case (since Pre-Fill isn't supported with the embed) but it's better to have it there than not.

4228
13
13 Comments
Tatiana_Tilearc
Level 1

What if you're linking to a PDF from your design studio?

Darrell_Alfons2
Level 10 - Champion Alumni

Hey Sanford can you please put in for speaker next year, I took a poll and everyone says it will be the most attended.

SanfordWhiteman
Level 10 - Community Moderator

Well, I've completed Step 1: Some People Have Seen Me In Real Life so maybe that's Step 2.

SanfordWhiteman
Level 10 - Community Moderator

You won't get the read-your-write feature in this case -- but it doesn't make a difference, since a PDF is incapable of Pre-Fill.

The RYW concept is a concern if the follow-up URL could Pre-Fill fields. A PDF or other binary/downloadable couldn't do that anyway.

Grégoire_Miche2
Level 10

Hi Sandy,

Re-posting here the complement made on this other version: Don't call a Marketo LP an “External URL” even if it sort-of-works

In multi-domain instances, we usually on the contrary have a programatic and systematic usage of External URLs. We use some code to re-add the aliId to the URL (Sorry no advanced editor).

This is all the more important as, Marketo always sets the domain of the follow-up LP to the default domain, whatever the domain of the LP containing the form.

<head>

    <script type="text/javascript" src="//mkto.domain.com/rs/999-XXX-999/images/URI.min.js"></script>

    <meta class="mktoString" id="ValidLPDomain" mktoName="Valid LP domain" default="{{my.web domain}}" />

    <meta class="mktoString" id="FollowupPage" mktoName="Follow up Page" default="" allowHtml="false">

</head>

<body>

  <script>

    MktoForms2.whenReady(function (form) {

        var formEl = form.getFormElem()[0],

            formElId = form.getId(),

            RightFUPDomain = "${ValidLPDomain}",

            WrongFUPDomain = "default.domain.com",

            ModFollowUpURL = "${FollowupPage}";

    //Form Success Event

    form.onSuccess(function(vals, followUpUrl){

      var currentURI = new URI(); // getting the full URL of the current page

      var defaultFollowUpURI = new URI(followUpUrl); // getting the full URL of the default follow-up page

      var currentURIqsValues = currentURI.query(true); // Get the object of query string parameter fo the default FUP

      var CurrentMktTok = currentURI.query(true).mkt_tok;

      var FUPaliId = defaultFollowUpURI.query(true).aliId;

      // getting the correct string for the follow-up, with no query string

      var fUrl = defaultFollowUpURI.search("").toString();

      if(ModFollowUpURL) {

        // set the new follow up page

        fUrl = ModFollowUpURL;

      }

      // finally setting the follow-up URI

      var newFollowUpURI = new URI(fUrl);

 

      // Correcting the domain if necessary

      if(newFollowUpURI.hostname() == WrongFUPDomain) {

        newFollowUpURI.hostname(RightFUPDomain);

      }

      if (FUPaliId) {

        newFollowUpURI.addSearch("aliId", FUPaliId);

      }

   

      console.log("form.onSuccess->follow up Url: "+newFollowUpURI.toString());

   

      document.location = newFollowUpURI.toString();

      return false;

    });

  });

  </script>

</body>

-Greg

SanfordWhiteman
Level 10 - Community Moderator

Sure, I mentioned that if you're calculating the Thank You URL in JS you need to append the aliId in JS.

But you can't read the aliId at all if you enter an unrecognized External URL: it will never be present in the onSuccess. You can only know the aliId if you use a recognized URL, so if you choose the Landing Page option, you will get both the appropriate path (page) and the querystring (inclding aliId). Then you redirect to the same path + querystring, only under the current location.hostname.

Dan_Stevens_
Level 10 - Champion Alumni

Great idea, but I don't think that will work.  The room will fill up way in advance and so many people will be shut out.  I'd rather see a panel Q&A with the Marketo product team as part of a main session following one of the keynotes in the main ballroom.  A "come to Jesus" type of session.  Now that would be cool!

Grégoire_Miche2
Level 10

Hi Sandy, the way we do is to set the ModFollowUpURL variable at LP level (as a LP variable that can be filled in with a my.token). The form itself is shared (from the design studio) and has a default followup page that IS a Marketo LP. And we instruct the user to let the "form default" setting when they insert the form in the LP. Therefore, the followUpUrl variable will contain the aliId.

-Greg

Grégoire_Miche2
Level 10

Would love to be there and see this

-Greg

SanfordWhiteman
Level 10 - Community Moderator

Proves my point, then.