Dynamic Languages on One Page: Redirect too Fast | Community
Skip to main content
January 31, 2018
Question

Dynamic Languages on One Page: Redirect too Fast

  • January 31, 2018
  • 1 reply
  • 4274 views

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?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

Grégoire_Miche2
Level 10
January 31, 2018

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
January 31, 2018

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
January 31, 2018

Ho Yes, I had forgotten about this one!

-Greg