SOLVED

Re: Help please - landing page not triggering in smart list

Go to solution
Anonymous
Not applicable

Hi There,

Im at the pointy end of a project that is due soon and something is amiss so any help is appreciated.

Here is what I am trying to achieve.

1. Customer receives email to complete a survey on survey monkey

2. After completion they are redirected to a landing page

3. There is a smart campaign listening for this to occur

pastedImage_0.png

pastedImage_1.png

4. Program status changed to > completed survey

I have been trying unsuccessfully for a day to sort this.

Thanks

Matt

1 ACCEPTED SOLUTION
SanfordWhiteman
Level 10 - Community Moderator

You already had the redirection code (in the onSuccess).  You seem to be cutting and pasting from different sources.

The full code to auto-submit and redirect is:

<script src="//app-sj01.marketo.com/js/forms2/js/forms2.min.js"></script>

<form id="mktoForm_1057"></form>

<script>

MktoForms2.loadForm("//app-sjst.marketo.com", "785-UHP-775", 1057, function(form) {

    //Add an onSuccess handler

    form.onSuccess(function(values, followUpUrl) {

        // Take the lead to a different page on successful submit, ignoring the form's configured followUpUrl

        location.href = "https://www.surveymonkey.com/r/5KQ3VGB";

        // Return false to prevent the submission handler continuing with its own processing

        return false;

    });

  form.submit();

});

</script>

You will need the Munchkin JS and Muchkin.init() as well.  But, as I've noted, your resulting code will have a race condition.  It will not satisfy your requirements reliably. I would not use it on a production site.

View solution in original post

83 REPLIES 83
SanfordWhiteman
Level 10 - Community Moderator

1/ You can set up the follow-up page when defining the form in Marketo, you do not need to do it in the JS.

Unless you're using the same form for multiple possible destinations, yes.

There's still a race condition here, btw.  Unlikely as you are to encounter it, there is actually no contractual (in the programming sense) guarantee that the Munchkin cookie will exist at the time you submit the form.

Grégoire_Miche2
Level 10

Hi again Sanford,

Since the issue is when the munchkin code is executed, would it make sense to use a free form template without the default Marketo code and add to it the synchronous/simple munchkin followed by a small JS that sends the lead to the SM page when it's completed ?

-Greg

SanfordWhiteman
Level 10 - Community Moderator

P.S. You are going to Summit next year, I hope?  I feel there are so many late-night geek sessions waiting to happen...

Grégoire_Miche2
Level 10

Hi again Sanford,

I am not sure I'll have time. I am running a small shop during the day and it's really hard to be away almost a week (including travel time).

-Greg

Anonymous
Not applicable

Hi,

The value 999-xxx-999 is this referring to the munchkin code. Also The second part of the JS is this right for the re-direct?

MktoForms2.loadForm("//app-sjst.marketo.com", "785-UHP-775", 1057, function(form) {

    //Add an onSuccess handler

    form.onSuccess(function(values, followUpUrl) {

        // Take the lead to a different page on successful submit, ignoring the form's configured followUpUrl

        location.href = "https://www.surveymonkey.com/r/5KQ3VGB";

        // Return false to prevent the submission handler continuing with its own processing

        return false;

    });

});

</script>

Anonymous
Not applicable

I answered my own question. Its the Munchkin code.

I just need to figure out the redirect.

Here is the code

<script src="//app-ab02.marketo.com/js/forms2/js/forms2.min.js"></script>

<form id="mktoForm_2190" style="display:none"></form>

<script>

     MktoForms2.loadForm("//app-ab02.marketo.com", 663-HBN-994", 2190, function(form) {

          MktoForms2.whenReady(function (form) {

               form.submit();

          });

     });

</script>

SanfordWhiteman
Level 10 - Community Moderator

You already had the redirection code (in the onSuccess).  You seem to be cutting and pasting from different sources.

The full code to auto-submit and redirect is:

<script src="//app-sj01.marketo.com/js/forms2/js/forms2.min.js"></script>

<form id="mktoForm_1057"></form>

<script>

MktoForms2.loadForm("//app-sjst.marketo.com", "785-UHP-775", 1057, function(form) {

    //Add an onSuccess handler

    form.onSuccess(function(values, followUpUrl) {

        // Take the lead to a different page on successful submit, ignoring the form's configured followUpUrl

        location.href = "https://www.surveymonkey.com/r/5KQ3VGB";

        // Return false to prevent the submission handler continuing with its own processing

        return false;

    });

  form.submit();

});

</script>

You will need the Munchkin JS and Muchkin.init() as well.  But, as I've noted, your resulting code will have a race condition.  It will not satisfy your requirements reliably. I would not use it on a production site.

Anonymous
Not applicable

Hi Sanford,

For some reason the page goes no wear, here is the full script

<script src="//app-sj01.marketo.com/js/forms2/js/forms2.min.js"></script>

<form id="mktoForm_2190"></form>

<script>

MktoForms2.loadForm("//app-sjst.marketo.com", "663-HBN-994", 2190, function(form) {

    //Add an onSuccess handler

    form.onSuccess(function(values, followUpUrl) {

        // Take the lead to a different page on successful submit, ignoring the form's configured followUpUrl

        location.href = "https://www.surveymonkey.com/r/5KQ3VGB";

        // Return false to prevent the submission handler continuing with its own processing

        return false;

    });

  form.submit();

});

</script>

SanfordWhiteman
Level 10 - Community Moderator

If you look in your console, you'll see that form is nuil.

form is null because subscriber (Munchkin ID) "663-HBN-994" is not valid. You can see this in the response to getForm().

Anonymous
Not applicable

Hi Sanford, I know this must be like pulling teeth, but what do I put in the Muchkin id parameter within the js.

SanfordWhiteman
Level 10 - Community Moderator

That's your Munchkin Account ID.  You can see it under Admin >> Integration >> Munchkin.

Anonymous
Not applicable

Thats confusing as that is where I got the code from the start and is not working

Grégoire_Miche2
Level 10

Hi Matthew,

Please paste the URL of the Landing Page.

-Greg

Anonymous
Not applicable

Here is the munchkin code

pastedImage_0.png

And here is the form url

http://pages.nlc.com.au/2015-11-Customer-Survey_LP-Auto-redirect.html

Grégoire_Miche2
Level 10

Your code in the LP is :

<script src="//app-sj01.marketo.com/js/forms2/js/forms2.min.js"></script>

<form id="mktoForm_2190"></form>

<script>

MktoForms2.loadForm("//app-sjst.marketo.com", "663-HBN-994", 2190, function(form) {

    //Add an onSuccess handler

    form.onSuccess(function(values, followUpUrl) {

        // Take the lead to a different page on successful submit, ignoring the form's configured followUpUrl

        location.href = "https://www.surveymonkey.com/r/5KQ3VGB";

        // Return false to prevent the submission handler continuing with its own processing

        return false;

    });

  form.submit();

});

</script>

So it's likely the code 2190 for the form ID is not correct.

Please check this then (go to the form in Marketo, then "form action -> embed code".

-Greg

Anonymous
Not applicable

This is the embed code for the form, it appears ok?

pastedImage_0.png

Grégoire_Miche2
Level 10

Apparently, it works...

One of the lessons to be learnt is that to work on forms 2.0, always start from the code extracted from Marketo.

-Greg

Anonymous
Not applicable

Nice work on this I learned a lot!

Grégoire_Miche2
Level 10

You still have a app-sjst in a URL, line 337 of the page.

MktoForms2.loadForm("//app-sjst.marketo.com", "663-HBN-994", 2190, function(form) {

change it to

MktoForms2.loadForm("//app-ab02.marketo.com", "663-HBN-994", 2190, function(form) {

-Greg

Anonymous
Not applicable

Just Tried on a new LP, still no go

Thankyou

Anonymous
Not applicable

Defiantly. Maybe the Lp is bugged Ill try it on a new one