Custom HTML for Known Visitor Issue | Community
Skip to main content
June 26, 2014
Question

Custom HTML for Known Visitor Issue

  • June 26, 2014
  • 5 replies
  • 1850 views
Hi,

I want to expedite form fills for known users and I plan to use the "If Known Visitor" option of forms 2.0. The issue I'm running into is when we switch it to custom HTML for known visitors, the values in hidden fields aren't passed through anymore because those fields technically don't exist. We use hidden fields for proper reporting and tracking so when these fields aren't present, it causes issues in our operations.

Has anyone found a solution to this?

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

5 replies

July 8, 2014
Found a solution to this and wanted to post it in case it can help other Marketo users.

My solution was to use the Forms 2.0 embed code to embed the code onto a Marketo landing page (as opposed to dropping it onto the page with the GUI). Then we can customize the embed code with API calls to add hidden form fields outside of the actual form. This way, it is permanently there in both situations, whether a visitor is anonymous or known.

http://developers.marketo.com/documentation/websites/forms-2-0/
September 8, 2014

We are having the exact same issue. We are looking into using the API calls for the solution, however we do not know how to fill in the hidden field via a url parameter. We can do it if it is static, however not if it is passed through via aparameter. 

Does anyone know how to populate a hidden field created by an api call with a url parameter?
December 12, 2014
I'd definitely like to know about this also.
January 21, 2015
Hey guys,

Sorry for the very delayed response here. I worked with a developer to get this javascript code working on our page. If I remember correctly, it takes the URL and separates out the query string values. Then the second set of javascript adds the hidden fields and fills it with the query string.

<script type="text/javascript">
function getUrlVars() {
    var map = {};
    var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
        map[key] = value;
    });
    return map;
}
</script>

This should be placed after the form has been called since it uses the whenReady function of the API.

<script>
var hiddenFields = getUrlVars();

MktoForms2.whenReady(function(form){
form.addHiddenFields({"MARKETO-FIELD-NAME":hiddenFields.QUERY-STRING-NAME || "DEFAULT-VALUE"});
});
</script>

Hope this helps!
Billy
January 28, 2015
Do any of you use the "known visitor" functionality on marketo landing pages? Will I still have this issue? We are just starting to test and use marketo landing pages instead of embedding it on our pages to reduce design time, etc.