How to Create a Field That Grabs the Web Page the Form Was Filled Out On

Description description

You want to create a field that will grab the web page the form was filled out on and add this as a token in an alert that goes to sales when a form is filled out.

Resolution resolution

This can be achieved either through a Smart Campaign or the JS API code. The code is more efficient because it doesn’t mean another trigger is active in your instance.

Smart campaign:

You’ll want to create a smart campaign with

Smart List - Fills Out Form

and

Flow - Change Data Value, [ your field name] , New Attribute is {{trigger.Web Page}}

You would need to reference the trigger token in the alert email so the team knows what product page the end user filled out the form on.

Code: (Embedded Form)

This can be done with a hidden field.

MktoForms2.loadForm("//app-<b>01.marketo.com", "</b>*-<b>*-</b>*", 148, function(form) {
    form.addHiddenFields({ LastFormURL : document.location.href });
});

The asterisks represent your company’s Marketo data (your Munchkin ID and Marketo instance). Your developer will know what to do if s/he is already using the embed code.

Code: (Marketo LP)

In a Marketo LP, you will have to edit the template and put this at the end, before the </body> tag:

<script>
MktoForms2.whenReady(function (form) {
    form.addHiddenFields({ LastFormURL : document.location.href });
});
</script>
recommendation-more-help
3d58f420-19b5-47a0-a122-5c9dab55ec7f