AnsweredAssumed Answered

Mysterious behavior - form submissions not registering - what's happening?

Question asked by 540d4c2f8c5d77cec876bb0eafd9dbdb40b95526 on Mar 16, 2016
Latest reply on Mar 17, 2016 by 540d4c2f8c5d77cec876bb0eafd9dbdb40b95526

Ok folks, I am really stumped on this one, as is Marketo Support. I recently tried implementing Gregoire's excellent solution to capture UTM values and store them in cookies, awaiting a lead's next form submission, at which time the data will be transferred to the form via hidden fields, and fed into UTM processing campaigns.


I built everything in a way that I thought to be exactly correct. However, something in the code is hijacking the Marketo form submission process. When a person submits a form on one of our pages (which are not hosted on Marketo), occasionally it works perfectly fine - it submits the captured UTM values along with the standard form fields. However, most of the time, Marketo does not register the form submission. From the lead's perspective, they filled out the form, got the subsequent success message, etc. However, in the lead's activity log, there is no record of the form submission. They were using standard browser mode, not incognito. Initially it appeared to be a caching issue - after clearing cache it would work more reliably - but that has ceased to work. Even with a clear cache, no form submission is recorded.


Here is the code that I think must be throwing off Marketo's system:



  getCookies(); // successfully retrieves all the cookies set with the values utm_campaign_log, original_utm_campaign, etc...
  "latestReferrer": latest_session_referrer,
  "utmCampaignHistoryCapture": utm_campaign_log,
  "utmContentHistoryCapture": utm_content_log,
  "utmMediumHistoryCapture": utm_medium_log,
  "utmSourceHistoryCapture": utm_source_log,
  "originalUTMCampaign": original_utm_campaign,
  "originalUTMContent": original_utm_content,
  "originalUTMMedium": original_utm_medium,
  "originalUTMSource": original_utm_source,
  "originalSessionDatetime": original_session_datetime,
  "originalSessionReferrer": original_session_referrer,
  "utmCampaignCapture": session_utm_campaign,
  "utmContentCapture": session_utm_content,
  "utmMediumCapture": session_utm_medium,
  "utmSourceCapture": session_utm_source

  }, 2000);

  Cookies.remove('utm_campaign_log', { domain: '' });
  Cookies.remove('utm_source_log', { domain: '' });
  Cookies.remove('utm_medium_log', { domain: '' });
  Cookies.remove('utm_content_log', { domain: '' });
  console.log("Form submitted. Removed UTM log cookies.");


This code first has a setTimeout function so that it makes sure any new cookies have been set before updating the form. Then it retrieves cookies (successfully) and sets hidden form values (successfully) within any form contained on the page. 


Screen Shot 2016-03-15 at 4.24.46 PM.png


When that form is submitted, frequently, Marketo has no memory of it.




Do any of you geniuses know what could be causing this frustrating behavior? Am I missing something critical from my MktoForm2.whenReady function? We would be so grateful for any help!