SOLVED

Re: Populate Custom Lead Record via Typeform Survey

Go to solution
Spencer_Philli1
Level 3

Populate Custom Lead Record via Typeform Survey

Hello Marketing Nation,

Preface:

I am trying to reverse engineer something and am stumped. This was built by an agency that is no longer working with the company, prior to me coming on board.

Background:

We have a Typeform survey on our site. When someone completes the survey they are emailed their results. Those results are also appended to their lead/person record in Marketo.

Some of these custom fields are not populating, however.

I, for the life of me, can not ascertain where and how Marketo knows to pull and populate the Typeform survey data from our website.

Marketo and Typeform are not "talking" to each other - Marketo is pulling data from our website directly. There is no direct integration between these two systems.

There are no webhooks, and no Zapier integration.

There is nothing on the Marketo form that gates the entry to the survey that would capture the Typeform data.

There is nothing in the smart campaign that sends people their email after completing the survey that would inform Marketo to capture the Typeform data and append to the lead record.

Please see screenshots below:

1. Custom fields in field management

Screen Shot 2018-01-12 at 5.32.13 PM.png

2. The custom fields in the lead/person record - I'm trying to identify how the populated fields were pulled in to populate the remaining, empty fields.

Stumped.png

3. In looking at the activity activity details it seems that Marketo is pulling the numbers from the URL itself...:

Screen Shot 2018-01-12 at 12.57.18 PM.png

Any ideas on where and how Marketo decides to correctly pull and populate this Typeform data without being connected to Typeform is greatly appreciated.

Based on that, I can replicate for the unpopulated fields.

Thank you,

Spencer

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Populate Custom Lead Record via Typeform Survey

There's a hidden Marketo form post on workwithopal.com/mci/mci-score, using URL parameters forwarded from the TypeForm results.

pastedImage_0.png

View solution in original post

6 REPLIES 6
SanfordWhiteman
Level 10 - Community Moderator

Re: Populate Custom Lead Record via Typeform Survey

There's a hidden Marketo form post on workwithopal.com/mci/mci-score, using URL parameters forwarded from the TypeForm results.

pastedImage_0.png

Spencer_Philli1
Level 3

Re: Populate Custom Lead Record via Typeform Survey

Sanford, I can't thank you enough. Seriously, thank you!

So, it turns out the connection IS associated with the hidden form at the end of the experience after all, albeit via the code on that page.

I was stumped because, in Marketo, the only field on the form is the hidden lead source...There aren't any form fields related to the Typeform data. Rather, to you point, it's the code on the URL requesting the info from Typeform!

Thank you,

Spencer

SanfordWhiteman
Level 10 - Community Moderator

Re: Populate Custom Lead Record via Typeform Survey

Right, great thing about addHiddenFields is that you don't need to put anything in Form Editor first... drawback is you have to know where the code is at.

P.S. I wouldn't have coded it like this -- all the userArray[] stuff is way too fragile as it relies on a specific order of URL parameters instead of names. (Technically, yes, the query string *can* be regarded as having an order -- the characters are in order, of course! -- but almost no one uses it that way.)

Spencer_Philli1
Level 3

Re: Populate Custom Lead Record via Typeform Survey

Got it. Out of curiosity how did you find the code on this URL - did you "command + F" for "mkto" or another word that would be typically be associated with a Marketo element in the source code of the URL?

And noted about the way it was coded. I will definitely be sharing this with our web dev for best practices as we move this in-house.

Thanks again,

Spencer

SanfordWhiteman
Level 10 - Community Moderator

Re: Populate Custom Lead Record via Typeform Survey

Got it. Out of curiosity how did you find the code on this URL - did you "command + F" for "mkto" or another word that would be typically be associated with a Marketo element in the source code of the URL?

First I ran your site via a proxy server (Fiddler) to see which page posted to Marketo.

Then, yep: view-source and find "mktoforms2" (that's the Forms API main object).

And noted about the way it was coded. I will definitely be sharing this with our web dev for best practices as we move this in-house.

I was looking at it more the other day and it's really pretty bad... for one thing, it does this at the beginning:

window.location.href.split("&").shift()

This discards the first query parameter, without explaining why (and starting with window.location.href instead of window.location.search is itself inexplicable).

So not only does it rely on query parameters, commonly interpreted as unordered key-value pairs, having a fixed order, it also relies on the first parameter (whatever that is) being disposable.

The first rule of URL parsing is Don't write a URL parser! Use an established open-source library like URI.js. Attempts to roll your own, even with seemingly predictable inputs, are doomed to eventually fail.

Spencer_Philli1
Level 3

Re: Populate Custom Lead Record via Typeform Survey

Duly noted! I'll will definitely be passing all of this along.