I'm not someone that uses Javascript. For the instructions of inserting this code into the Marketo embedded form code, how does it drop in exactly?
Like this:
<script src="//app-lon07.marketo.com/js/forms2/js/forms2.min.js"></script>
<script>(function(opts){
var current = {
state : document.location.href,
query : document.location.search.substring(1),
time : new Date().getTime()
},
storage = {
area : window.localStorage,
key : 'last_utm_query'
},
restored,
updated = {};
if (/(^|&)utm_/.test(current.query)) {
storage.area[storage.key] = JSON.stringify({ time:current.time, query:current.query });
} else if (restored = JSON.parse(storage.area[storage.key] || '""')) {
if ( window.MktoForms2 && ( current.time - restored.time <= opts.expireDays * 864E5 ) ) {
updated.state = document.createElement('a');
updated.state.href = current.state;
updated.state.search += (updated.state.search ? '&' : '') + restored.query + '&restored=' + restored.time;
history.replaceState('', {}, updated.state);
}
}
})({
expireDays : 30
});</script>
<form id="mktoForm_1043"></form>
<script>MktoForms2.loadForm("//app-lon07.marketo.com", "041-BQO-927", 1043);</script>
Or like this:
<script src="//app-lon07.marketo.com/js/forms2/js/forms2.min.js">(function(opts){
var current = {
state : document.location.href,
query : document.location.search.substring(1),
time : new Date().getTime()
},
storage = {
area : window.localStorage,
key : 'last_utm_query'
},
restored,
updated = {};
if (/(^|&)utm_/.test(current.query)) {
storage.area[storage.key] = JSON.stringify({ time:current.time, query:current.query });
} else if (restored = JSON.parse(storage.area[storage.key] || '""')) {
if ( window.MktoForms2 && ( current.time - restored.time <= opts.expireDays * 864E5 ) ) {
updated.state = document.createElement('a');
updated.state.href = current.state;
updated.state.search += (updated.state.search ? '&' : '') + restored.query + '&restored=' + restored.time;
history.replaceState('', {}, updated.state);
}
}
})({
expireDays : 30
});</script>
<form id="mktoForm_1043"></form>
<script>(function(opts){
var current = {
state : document.location.href,
query : document.location.search.substring(1),
time : new Date().getTime()
},
storage = {
area : window.localStorage,
key : 'last_utm_query'
},
restored,
updated = {};
if (/(^|&)utm_/.test(current.query)) {
storage.area[storage.key] = JSON.stringify({ time:current.time, query:current.query });
} else if (restored = JSON.parse(storage.area[storage.key] || '""')) {
if ( window.MktoForms2 && ( current.time - restored.time <= opts.expireDays * 864E5 ) ) {
updated.state = document.createElement('a');
updated.state.href = current.state;
updated.state.search += (updated.state.search ? '&' : '') + restored.query + '&restored=' + restored.time;
history.replaceState('', {}, updated.state);
}
}
})({
expireDays : 30
});
MktoForms2.loadForm("//app-lon07.marketo.com", "041-BQO-927", 1043);</script>
Or some other way I'm not interpreting?