SOLVED

Partner Referral Form and pURL

Go to solution
Elliott_Lowe1
Level 9 - Champion Alumni

Partner Referral Form and pURL

We'd like to create a Marketo landing page with a form that will allow authorized partners to submit referrals.  We're going to use a pURL for this, so that only authorized partners will have the form displayed to them.  We'd like to capture the partner's SFDC Account ID into a hidden form field, so the partner doesn't have to enter it. 

One way to do this is to add the Account ID as a query parameter in the link we provide the partner and the form would capture the URL Parameter into a hidden form field  However, if the partner navigates to the page without the link, that query parameter will no longer be available.  We could potentially store the query parameter in a cookie, but it could become deleted, they could initially navigate to the pURL without the query parameter, etc.

Since the partner will be using a pURL, and the LP can have snippets / tokens containing information from that lead's record, I'm guessing it's possible to set the Account ID in a Data Transfer Object and write that value into a hidden form field.  I looked at a few discussions and developers.marketo.com docs for Forms 2.0 and came up with the following HTML to include on the LP, but not surprisingly, it doesn't work (munchkin ID is replaced with x)'s.  I'm sure that I'm not setting or reading the AccountID variable correctly and would appreciate any recommendations.

<div ID="AccountID" style="display:none">{{lead.Account ID (18)}}</div>

<script>

MktoForms2.loadForm("//app-sj08.marketo.com", "xxx-xxx-xxx", 1769, function(form) {

    // Set the value of the Referring Partner field

    form.vals({"Referring Partner":"AccountID"});

});

</script>

Tags (2)
1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Partner Referral Form and pURL

Thanks! The hidden field exists in the Form, but prefill won't work since Munckin will be disabled and the cookie archived since this is a referral form.

Technically an existing cookie isn't necessary for PreFill (viz. mkt_tok) but yeah, with neither available you need to take a different tack.

In the pURL context, you should still be able to set the default value of a field to your {{lead.token}}, another PreFill emulation.  Try that first for simplicity.

Should I remove the hidden field from the form when setting the value via the Forms 2.0 JS?

Up to you, but if the field is not on the form, use form.addHiddenFields() instead of form.setValues().

Dumb question alert - if I dragged and dropped the form onto the LP, how do I edit the form JS?

Add a separate HTML Element with <script>MktoForms2.whenReady(...)</script> in it.

View solution in original post

6 REPLIES 6
SanfordWhiteman
Level 10 - Community Moderator

Re: Partner Referral Form and pURL

You don't need a DTO if you're on an LP.

Just put the token right in the Forms 2.0 JS (assuming this is a field you can't bring into the form directly as hidden w/PreFill enabled).

MktoForms2.whenReady(function(form){

  form.setValues({ "Referring Partner" : "{{Lead.Account ID (18)}}" });

});

Elliott_Lowe1
Level 9 - Champion Alumni

Re: Partner Referral Form and pURL

Thanks!  The hidden field exists in the Form, but prefill won't work since Munckin will be disabled and the cookie archived since this is a referral form.   Should I remove the hidden field from the form when setting the value via the Forms 2.0 JS?

Dumb question alert - if I dragged and dropped the form onto the LP, how do I edit the form JS?

SanfordWhiteman
Level 10 - Community Moderator

Re: Partner Referral Form and pURL

Thanks! The hidden field exists in the Form, but prefill won't work since Munckin will be disabled and the cookie archived since this is a referral form.

Technically an existing cookie isn't necessary for PreFill (viz. mkt_tok) but yeah, with neither available you need to take a different tack.

In the pURL context, you should still be able to set the default value of a field to your {{lead.token}}, another PreFill emulation.  Try that first for simplicity.

Should I remove the hidden field from the form when setting the value via the Forms 2.0 JS?

Up to you, but if the field is not on the form, use form.addHiddenFields() instead of form.setValues().

Dumb question alert - if I dragged and dropped the form onto the LP, how do I edit the form JS?

Add a separate HTML Element with <script>MktoForms2.whenReady(...)</script> in it.

Elliott_Lowe1
Level 9 - Champion Alumni

Re: Partner Referral Form and pURL

Thanks!  You're absolutely correct - when using pURL's the absence of the _mkto_trk cookie doesn't prevent the tokens from working in the Default Value field when Autofill is set to Use Default Value.  One caveat, if the Follow Up With option in the form is set to 'Stay on page', after form submissions, the tokens in the pURL point to the new lead record.  You have to reload the page (e.g. Back button in browser) to have it point to the tokens associated with the referrer's record again.  Is there anyway to keep the tokens pointing to the referrer's record? 

Also, how do you archive and restore the _mkto_trk cookie?

SanfordWhiteman
Level 10 - Community Moderator

Re: Partner Referral Form and pURL

If you intercept the onSuccess and return false; then (by definition) nothing in the form will change, as the page is staying exactly as it was before the form submit.

Elliott_Lowe1
Level 9 - Champion Alumni

Re: Partner Referral Form and pURL

Thanks again!

How do you archive and restore the _mkto_trk cookie?