Dynamic Languages on One Page: Redirect too Fast

Anonymous
Not applicable

Dynamic Languages on One Page: Redirect too Fast

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

Re: Dynamic Languages on One Page: Redirect too Fast

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

Re: Dynamic Languages on One Page: Redirect too Fast

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.

Grégoire_Miche2
Level 10

Re: Dynamic Languages on One Page: Redirect too Fast

Ho Yes, I had forgotten about this one!

-Greg

Mark_Price
Level 7

Re: Dynamic Languages on One Page: Redirect too Fast

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

Dan_Stevens_
Level 10 - Champion Alumni

Re: Dynamic Languages on One Page: Redirect too Fast

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

Anonymous
Not applicable

Re: Dynamic Languages on One Page: Redirect too Fast

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

Re: Dynamic Languages on One Page: Redirect too Fast

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

Re: Dynamic Languages on One Page: Redirect too Fast

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

Re: Dynamic Languages on One Page: Redirect too Fast

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.