{"id":5080,"date":"2021-01-26T16:48:10","date_gmt":"2021-01-26T21:48:10","guid":{"rendered":"https:\/\/www.greatbigdigitalagency.com\/?p=5080"},"modified":"2022-04-22T14:41:20","modified_gmt":"2022-04-22T18:41:20","slug":"implement-marketo-pre-fill-on-wordpress","status":"publish","type":"post","link":"https:\/\/www.greatbigdigitalagency.com\/blog\/implement-marketo-pre-fill-on-wordpress\/","title":{"rendered":"How to Implement Marketo Form Pre-Fill on WordPress in 2021"},"content":{"rendered":"\n

Note: Because GBDA specializes in WordPress development<\/a>, the solution presented is tailored to WordPress but the principles will be the same for implementation on any platform.<\/em><\/p>\n\n\n\n

Have you come seeking the Holy Grail of Marketo form pre-fill on WordPress? We know, the documentation was confusing, the desert sun was unforgiving, and the Google searches were unfruitful. Come, weary traveller, sit with us at the Great Big Tavern<\/a> and let us share in our common tales of woe. We will give you ale to elevate your spirits, and you will leave here with the knowledge you seek.<\/p>\n\n\n\n

\"How
A crusading web developer surveys the landscape, yearning for Marketo forms to pre-fill, with lightning bolt<\/figcaption><\/figure>\n\n\n\n

I don\u2019t really want to drink anything. I just want to pre-fill my Marketo forms…<\/h2>\n\n\n\n

Ok, suit yourself. I wanted to write this blog because I had a good deal of trouble finding a workable solution for pre-filling Marketo forms, and I\u2019m hoping it can be of use to you if you\u2019re in the same boat. I will say that after a great deal of searching, all of the information was out there, it was just spread out across various articles and bits of documentation that aren\u2019t well indexed by Google at the moment.<\/p>\n\n\n\n

My sense is that it\u2019s all a bit muddled because the methods to implement pre-fill (and restrictions on it) have been evolving. As of today, the only way to do pre-fill is through custom code (scroll down for our solution), but it can be confusing sifting through the search results when some older documentation seems to indicate pre-fill should work out of the box while others point to functionality that just doesn\u2019t exist anymore. On top of it all, Marketo changed their policy regarding pre-fill<\/a> as recently as April 2019 to be more restrictive (emphasis mine):<\/p>\n\n\n\n

Starting April 24, 2019, Marketo will only pre-fill form fields if the URL used to navigate to the Marketo landing page contains a valid mkt_tok URL parameter value (which occurs when users click tracked links in Marketo emails).<\/strong> What that means is, any time a person is viewing a Marketo landing page with a form, the URL being used must contain the mkt_tok token in the query string, otherwise the form on that landing page will not be pre-filled. If the URL in the browser window does have a valid mkt_tok tracking token, then the form within the page will pre-fill as expected with data corresponding to the person record associated with that mkt_tok.<\/p>

Also note that if you are embedding Marketo Landing Pages within other web pages using an <iframe>, the mkt_tok would need to be passed from the parent page to the <iframe> URL if you intend for form prefill to work within the <iframe><\/p>

<\/p><\/blockquote>\n\n\n\n

So essentially in order to pre-fill form fields, the user must be coming from a marketing email where they clicked a link containing a unique token (mkt_tok) in the query string. This is all done for reasons of security and UX, which is explained in more detail in the link above.<\/p>\n\n\n\n

\"\"
This coffee smells terrible, AND I can\u2019t figure out how to implement pre-fill for my Marketo forms!<\/figcaption><\/figure>\n\n\n\n

Before we move on to our solution, here are a couple of useful links I found along the way that led me to the promised land. Maybe some nugget contained within, in combination with our solution, will be useful to you on your travels:<\/p>\n\n\n\n

\n
External Page Prefill<\/a><\/blockquote>