SOLVED

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
Grégoire_Miche2
Level 10

I still see "app-sjst" in the LP. Have you approved it after your change ?

-Greg

Anonymous
Not applicable

Updated doest seem to be firing

<script src="//app-ab02.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

That matters a lot.

Grégoire_Miche2
Level 10

Yes it does, and all the codes are correct.

What is different in your JS and in the screen shots are the first lines:

The scr URL is not the same.

In your LP, it shows

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

in the screen shot, it's :

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

I a not sure it matters, but we should eliminate this, so please fix the LP.

-Greg

SanfordWhiteman
Level 10 - Community Moderator

You need to use your Munchkin ID and an existing form ID in your instance.  That's the only thing stopping that code from working.  I'm not just speaking from memory -- I literally embedded that code in a webpage and it worked (or "worked" in quotes, given the other caveats).

SanfordWhiteman
Level 10 - Community Moderator

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

Yes, it would.

This whole process really needs to be either synchronous or tightly-managed-async or it's going to screw up.

Grégoire_Miche2
Level 10

Hi Sanford,

Doesn't the "wenReady" method help on this ?

-Greg

SanfordWhiteman
Level 10 - Community Moderator

Doesn't the "wenReady" method help on this ?

As you probably already figured, nope.

You've got two processes running both automatically and asychronously that usually have a human factor "guaranteeing" enough breathing room.

Anonymous
Not applicable

Hi Greg,

One last question I think, how can I set up the redirect to the SM page.

Thanks

Anonymous
Not applicable

Hi Matthew,

There are several ways to 'auto submit' a form.

Basically,

1> Create a Marketo simple form landing page(may be with only email address)

2> On this landing page, add javascript code like,

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<script type="text/javascript">
  $
(document).ready(function() {
  window
.document.forms[0].submit();
 
});
</script>

Basically, as soon as this landing page is loaded in browser, that form gets auto submitted. Assuming that the email address was pre-populated, it will create a 'form filled' event in Marketo which you can listen to in your smart campaign.

3> Have this form redirect to your SurveyMonkey form.

Hope this helps

Rajesh

Grégoire_Miche2
Level 10

Hi Rajesh,

IMHO, better use Marketo forms 2.0 API to do this.

-Greg

Anonymous
Not applicable

I agree with you.

As I said, there are multiple ways to do it. The one I mentioned is a more generic way which anyone without Marketo expertise would be able to do.

Rajesh

SanfordWhiteman
Level 10 - Community Moderator

That is not correct.  When forms may be dynamically inserted into the DOM after domReady, you ​must ​use their own API.  Otherwise you are creating a race condition.  Please do not recommend this going forward.

Anonymous
Not applicable

I see. Thanks


Rajesh

Grégoire_Miche2
Level 10

Hi Matthew,

This will be easier if you use a free form LP. A white one will do the job. Create the form in Marketo. Do not add it to the LP in the standard way, and get form embedded code instead.

It will look like this :

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

<form id="mktoForm_1272"></form>

<script>MktoForms2.loadForm("//app-e.marketo.com", "999-XXX-999", 1272);</script>

Just change the middle line code to :

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

and the last line to :

<script>MktoForms2.loadForm("//app-e.marketo.com", "999-XXX-999", 1272, function(form) {

    MktoForms2.whenReady(function (form) {

             form.submit();

        });

});

</script>

Paste the result as an HTML block in the page.

More to be found here : Forms 2.0 » Marketo Developers

-Greg

Anonymous
Not applicable

Ive tried on 3 browsers firefox, chrome and edge

Anonymous
Not applicable

Its weird as its picking up a new subscriber.

Ive been at this for 15 hours, just saw my spelling mistake

pastedImage_0.png

Grégoire_Miche2
Level 10

Hi Matthew,

You probably need to start the tests from 0, with clean browsers.

If you have a Marketo LP just before entering the survey, just try something : add a couple of lead tokens ({{lead.id}}, {{lead.Email Address}}, {{lead.last name}} to the first page. Do the same with the last one. It will enable to check whether the lead is "recognized" by Marketo when you arrive from the email link.

If it's not, the problem comes from one of these possibilities :

  • the email link tracking is not enabled
  • You are using a browser with DoNotTrack features enabled.
  • The munchkin is not configured properly on your landing page

If it does show the values, then it can come from the following :

  • the LP template as the option "disable munchkin tracking" set

-Greg

Anonymous
Not applicable

Im going to give it a rest for tonight, if anyone can see what Im doing wrong any help would be appreciated.

Thanks

Anonymous
Not applicable

Is it all possible that this is occurring because I edited and moved around the program steps in admin?

Thanks

Grégoire_Miche2
Level 10

No, surely not.

-Greg