Dynamic Languages on One Page: Redirect too Fast

Anonymous
Not applicable

I'm looking for instructions on handling a Dynamic Language Preference landing page that includes dynamic preference forms, which redirect to a Dynamic Confirmation page. The Content is dynamic based on language segment with the default set to English.

Use Case: Initial landing page is set in English with a English form, once the new Language is selected, it redirects to the confirmation page, which should be returning the new dynamic language copy based on the first page's selection.

Issue: Redirect happens faster than the system has time to log the segment change, if you hit refresh after the redirect on the confirm page the language does update, but not fast enough.

Solution: Is there javascript that I can put on the landing page (and not affect other's used by the same template) that will allow the redirect to refresh, or delay enough time in order for the confirmation page to return the right language?

13 REPLIES 13
Grégoire_Miche2
Level 10

Hi Allison,

You will need to add a latency on the form so that the update has enough time to be processed by Marketo. In order to avoid issues with other LP's, you can control that latency with a Marketo boolean variable in the LP template.

First add the Boolean variable to the top of the LP template:

        <meta class="mktoBoolean" id="AddLantencyOnFormSubmit" mktoName="Add Latency on form submit" default="false" true_value="true" false_value="false" false_value_name="No Latency" true_value_name="4S Latency">

Then add the following code at the bottom of the LP template:

<script>

      MktoForms2.whenReady(function(form) {       

        form.onSuccess(function(values, followUpUrl) {

            if ('${AddLantencyOnFormSubmit}'=='true') {

                setTimeout(function(){location.href = followUpUrl;}, 4000);

                return false;

            }

        });

    });

</script>

There, the latency will be 4000 milliseconds, so 4 seconds. You can set that number to any duration.

Warning though: whatever the latency duration you set, it will never cover 100% of the cases. There will always be some cases where Marketo will be too slow.

-Greg

SanfordWhiteman
Level 10 - Community Moderator

You don't need to do it this way (which, with segment changes, will miss a lot of times).

Smply set the Follow Up URL to have the language segment in the query string.

  ?Language=fr

Where "Language" is the exact name of the segmentation and "fr" the segment name.

Anonymous
Not applicable

Sanford,

The follow-up URL, would that be the link to the dynamic confirmation page with the query string? So looking at the URL my External URL would be: http://go.tracelink.com/Language-Confirm.html?Language Preference=French

Is that right? How does it handle the space between the Language and Preference in the Segment name?

pastedImage_0.pngpastedImage_1.pngpastedImage_2.png

Dan_Stevens_
Level 10 - Champion Alumni

Allison - the url parameter must match exactly to your segmentation in Marketo.  So if you look at ours, for example:

pastedImage_0.png

Our URL parameter would be "?CountryParam=gb" (for the UK).

Anonymous
Not applicable

I understand that part,

my language segment name is:

Language Preference

how do I handle the parameter if there is a space in between my approved segment name's words?

?Language Preference=French

SanfordWhiteman
Level 10 - Community Moderator

Encode the space as %20.

Hope that works -- but I'll admit that when using this method I always use Segmentation & Segment names without spaces.

Anonymous
Not applicable

Will remember that for future. But also can you answer my question for the Link above,

does it go in the External URL of the form and link to the confirmation page link? (see screen shots in earlier message)

SanfordWhiteman
Level 10 - Community Moderator

No, you want to use the Form-Defined option, not the External URL option.

You're still controlling the Follow-up using the Form Editor UI.

In Form Editor, use Add Choice based on the Language Preference field to choose a different URL (i.e. differentiate by query string).

Anonymous
Not applicable

So in this part of the form UI

only the query string parameter in external URL? See image

This : http://go.tracelink.com/Language-Confirm.html?Language%20Preference=French

or this: ?Language%20Preference=Italian

pastedImage_0.png

SanfordWhiteman
Level 10 - Community Moderator

The full URL, with query string (I don't think the UI will even let you do a relative URL).

Dan_Stevens_
Level 10 - Champion Alumni

this is such a powerful, undocumented capability that originally surfaced in this thread (thanks, Sandy!):

Re: Display Different Text/Asset Images on LP Using Tokens

Mark_Price
Level 7

+1 for this method.  I'm approaching it this way as well and haven't had issues after many years.

Grégoire_Miche2
Level 10

Ho Yes, I had forgotten about this one!

-Greg