An emergency workaround for app-𝑛𝑛𝑛𝑛.marketo.com form embeds after next week’s Marketo URL change | Community
Skip to main content
SanfordWhiteman
New Participant
July 25, 2023

An emergency workaround for app-𝑛𝑛𝑛𝑛.marketo.com form embeds after next week’s Marketo URL change

  • July 25, 2023
  • 4 replies
  • 1488 views

Been reluctant to provide a short-term workaround for the rather big change coming next week to Marketo URLs. But based on recent research, I have the sense that many people’s form embeds will be impacted on August 1st, so let’s prevent a bad day in MOPSville.

 

You want to put these two scripts as high as possible in the <head> of all pages, of course replacing pages.example.com in both places with your LP domain:

<script src="//pages.example.com/js/forms2/js/forms2.min.js"></script> <script> "use strict"; MktoForms2.loadForm = new Proxy(MktoForms2.loadForm, { apply(target, thisArg, [instanceURL, ...rest]) { return Reflect.apply(target, thisArg, ["//pages.example.com", ...rest]); } }); </script>

 

By “as high as possible” I mean literally right after your last <meta> tag if you can. It must run before anything else related to Marketo forms, including GTM (which might inject Marketo form tags).

 

If you have this in place, you don’t have to worry about finding all the occurrences of the Forms 2.0 library and loadForm() calls throughout your code.

 

The right thing to do long-term is, of course, find and permanently fix all form embed codes  that use the old domains. But the “finding” part can be tricky, as can getting the right person to implement the fix.

 

P.S. I’ll update this post with more info about why the above works, for the JS learners.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

4 replies

SanfordWhiteman
New Participant
July 27, 2023

Yep, exactly.

New Participant
July 27, 2023

Thanks for sharing, Sanford! This may be a life saver, or at least a good insurance policy for those of us who are paranoid about missing affected form embeds. Just to confirm: this code would be used exactly as-is (except for the two references to the user's LP domain) correct? 

SanfordWhiteman
New Participant
July 26, 2023

Something tells me the same. 🙂

 

Dave_Roberts
New Participant
July 26, 2023

Thanks for sharing this, something tells me this is going to be a popular post in early August!