SOLVED

Re: Drawing page data into email?

Go to solution
Dylan_Bianchi
Level 2

Drawing page data into email?

Using the one Marketo form on multiple pages on our website, is it possible to trigger an email to the user once the form is filled with info on the page / content they filled in the form?

To maybe explain it differently:

Say we have 20 articles sitting on different pages on our website, using one basic Marketo form for the user to fill in their email, this form triggers an email to the user to indicate they have read the article.

How can I somehow map the title of that particular article where the form was filled as a token in the email to indicate which article it was?

This would save having to setup multiple forms and emails for each article published.

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Drawing page data into email?

If the campaign is triggering on Fills Out Form, you don't need a separate field on the lead for the URL: {{Trigger.Web Page}} and {{Trigger.Referrer}} already exist.

The title -- as in HTML <title> tag -- is different because it doesn't have a built-in token associated with it.

Capture the title to a hidden field like so (lastFormURLTitle is an example custom lead field):

MktoForms2.whenReady(function(form){

  form.addHiddenFields({ lastFormURLTitle : document.title });

});

View solution in original post

15 REPLIES 15
SanfordWhiteman
Level 10 - Community Moderator

Re: Drawing page data into email?

Pls move the thread to Products and I'll answer it over there. Move link is at the right.

Dylan_Bianchi
Level 2

Re: Drawing page data into email?

Hi Sanford Whiteman,

I thought it would notify me of a reply to this thread.

I have updated to the products category. I still don't have a solution for this issue.

Anonymous
Not applicable

Re: Drawing page data into email?

Hey Dylan,

I'm unsure how to pull in the page title, but we have a similar set up. 1 enquiry form on many different offer pages.

On our enquiry form, we have a hidden custom field (form URL detail) and then our web developers set up a way (javascript) to capture the URL of the page they're on into that hidden field.

Then in the alert email we have "{{lead.Full name}} has filled in the enquiry form on this page - {{lead.form URL detail}}"

That way the sales team know which offer a lead is enquiring about.

Another option is to have 1 form, but multiple smart campaigns using the webpage constraint (fills out form, webpage is www.example.com/article1). Then using the {{SP_Send_Alert_Info}} token in the alert, the name of the smart campaign (named per article) would come through in the alert emails.

Cheers

Katie

SanfordWhiteman
Level 10 - Community Moderator

Re: Drawing page data into email?

If the campaign is triggering on Fills Out Form, you don't need a separate field on the lead for the URL: {{Trigger.Web Page}} and {{Trigger.Referrer}} already exist.

The title -- as in HTML <title> tag -- is different because it doesn't have a built-in token associated with it.

Capture the title to a hidden field like so (lastFormURLTitle is an example custom lead field):

MktoForms2.whenReady(function(form){

  form.addHiddenFields({ lastFormURLTitle : document.title });

});

Dylan_Bianchi
Level 2

Re: Drawing page data into email?

Sanford Whiteman

Thanks for the info. When you talk about the {{Trigger.Web Page}}and {{Trigger.Referrer}} is this to determine what page the forms have to be triggered on? If yes, we would need trigger the email no matter what page the form is on.

When it comes to adding hidden field data. Just wanted to check, if I add this to every page the form is on, will it populate the form no matter what page it is on with that specific page title?

Would I then have to add that custom field token into the email, and that is all?

Dylan_Bianchi
Level 2

Re: Drawing page data into email?

Just to clarify,

I'm not a developer, so I am assuming this is just javascript I can add to the page with the forms, and this can be placed anywhere on the page? Or does it have to be linked with the munchkin script or something?

SanfordWhiteman
Level 10 - Community Moderator

Re: Drawing page data into email?

...this can be placed anywhere on the page? Or does it have to be linked with the munchkin script or something?

Has no relationship to Munchkin.

Add it to a page anywhere after the <script> tag that loads ​forms2.min.js.  ​On Marketo LPs it's safest to put it just inside the closing </body> tag.

SanfordWhiteman
Level 10 - Community Moderator

Re: Drawing page data into email?

Just wanted to check, if I add this to every page the form is on, will it populate the form no matter what page it is on with that specific page title?

Yep.

Would I then have to add that custom field token into the email, and that is all?

Yep. Just remember it will be overwritten on every form post (which is why I used the prefix last in the field name) so if someone submits two forms in succession you'd only see the last one's page title on the lead.  (Though you could look in the Activity Log Detail for each Filled Out Form event if you really wanted to look back at earlier values.)

Dylan_Bianchi
Level 2

Re: Drawing page data into email?

Sanford Whiteman

Sorry to have to confirm. So I need to:

1. create a new  'custom field' named 'lastFormURLTitle'

2. create a hidden field in the form using this field 'lastFormURLTitle'. Does Form Pre-fill have to be disabled?

3. embed the form into the page. Add the extra script you provided.

4. create the smart campaign including the email that includes the token for 'lastFormURLTitle'

Does all of this cover the tracking of the page title data from the page -> to the form -> to the database -> to the email?

Apart from this is the triggers for the email etc, but I think that is fine.