SOLVED

Ability to pre-fill form when linked to from a Marketo landing page?

Go to solution
ailsadempsey
Level 3

Ability to pre-fill form when linked to from a Marketo landing page?

Is there a way to have a Marketo form pre-fill if it's linked to from a Marketo landing page, that would be arrived at from a Marketo email (and so with mkt_tok)?

 

We are looking at developing a preference centre that houses a couple of email subscription options. We were also looking to have a separate unsubscribe page/form that would be a global unsubscribe, so the idea was to have copy on the unsubscribe page highlighting this and a link to manage preferences instead if preferred. However I'm not aware of a way to have the preference centre form pre-fill for a lead if they navigate there from the unsubscribe page (accessed from Marketo email) - only if they access the preference centre directly from the email. Is there a way to achieve this? Or is the only option to combine the two into one?

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Ability to pre-fill form when linked to from a Marketo landing page?


I tried to add a link to the landing page but I only had the option to mark it as track link, not add mkt_tok (as you do in the email editor).

Right, there’s no feature like that — understandably, as it would break the security approach of removing the mkt_tok on load.

 

What you can do is

  • add a special class only to those links you want to pass the mkt_tok
  • only add the mkt_tok when the link is clicked, not before, so if the link is copied it’s still secure

 

Use this HTML:

<a class="mktReTok" href="https://pages.example.com/unsubscribe">This link will have the original mkt_tok added</a>

 

And this JS:

document.addEventListener("DOMContentLoaded",function(){
  const arrayify = getSelection.call.bind([].slice);
  
  arrayify(document.querySelectorAll("a.mktReTok"))
  .forEach(function(link){
     link.addEventListener("click",function(){
       this.search += ( this.search ? "&" : "" ) + "mkt_tok=" + window.__mktTokVal;
     });
  });
});

 

View solution in original post

9 REPLIES 9
LucasMachado
Level 2

Re: Ability to pre-fill form when linked to from a Marketo landing page?

Hello,

 

I don't know a direct way of doing this, but you can do it with the 2 following steps

1. Create a trigger campaign for the e-mails. If the person clicks the unsubscribe link you update the preferences field value.

2. In the forms you enable the pre-fill of the preferences field

Tags (2)
SanfordWhiteman
Level 10 - Community Moderator

Re: Ability to pre-fill form when linked to from a Marketo landing page?

You should never update data based only on a Clicked Email, as you'll be responding to mail scanners, not just humans. 

 

I don't understand the rest of your post... how would that accomplish Pre-Fill?

 

 

LucasMachado
Level 2

Re: Ability to pre-fill form when linked to from a Marketo landing page?

you're right, I thought forms were still using munchkin code to pre-fill but now it is only the e-mail token. Sorry!

SanfordWhiteman
Level 10 - Community Moderator

Re: Ability to pre-fill form when linked to from a Marketo landing page?


However I'm not aware of a way to have the preference centre form pre-fill for a lead if they navigate there from the unsubscribe page (accessed from Marketo email) - only if they access the preference centre directly from the email. Is there a way to achieve this? Or is the only option to combine the two into one?

It’s easy to make this happen if they’re both Marketo LPs. Is that the case?

ailsadempsey
Level 3

Re: Ability to pre-fill form when linked to from a Marketo landing page?

Yep, both Marketo landing pages. I tried to add a link to the landing page but I only had the option to mark it as track link, not add mkt_tok (as you do in the email editor).

SanfordWhiteman
Level 10 - Community Moderator

Re: Ability to pre-fill form when linked to from a Marketo landing page?


I tried to add a link to the landing page but I only had the option to mark it as track link, not add mkt_tok (as you do in the email editor).

Right, there’s no feature like that — understandably, as it would break the security approach of removing the mkt_tok on load.

 

What you can do is

  • add a special class only to those links you want to pass the mkt_tok
  • only add the mkt_tok when the link is clicked, not before, so if the link is copied it’s still secure

 

Use this HTML:

<a class="mktReTok" href="https://pages.example.com/unsubscribe">This link will have the original mkt_tok added</a>

 

And this JS:

document.addEventListener("DOMContentLoaded",function(){
  const arrayify = getSelection.call.bind([].slice);
  
  arrayify(document.querySelectorAll("a.mktReTok"))
  .forEach(function(link){
     link.addEventListener("click",function(){
       this.search += ( this.search ? "&" : "" ) + "mkt_tok=" + window.__mktTokVal;
     });
  });
});

 

ailsadempsey
Level 3

Re: Ability to pre-fill form when linked to from a Marketo landing page?

Thanks so much!

hagans
Level 2

Re: Ability to pre-fill form when linked to from a Marketo landing page?

Hi,

where do you out that code?

SanfordWhiteman
Level 10 - Community Moderator

Re: Ability to pre-fill form when linked to from a Marketo landing page?

You can put it in the <head> or anywhere else, doesn’t matter as it waits for the page to be ready.