Widget personalization from link click?

Ryan_Bush
Level 1

Widget personalization from link click?

I'm planning on sending out 5-10 emails using Outlook. In this email, there will be a link to our website where a Marketo widget will appear. My question is - Is there any way to personalize the widget to display the person's name who clicked the link? For example, I send the email to someone named John. They click the link in the email to go to the website, and a widget appears saying, "Hello, John...".

I was thinking this might be possible using unique URLs for each person, but I'm not sure if that would be the best approach. Any help would be greatly appreciated!

3 REPLIES 3
SanfordWhiteman
Level 10 - Community Moderator

Re: Widget personalization from link click?

Is your "Marketo widget" a Marketo Forms 2.0 form?

Ryan_Bush
Level 1

Re: Widget personalization from link click?

It's a pop-up that appears after the home page loads. It has some text and a button that redirects the visitor to an info page about our services.

SanfordWhiteman
Level 10 - Community Moderator

Re: Widget personalization from link click?

If you have no way of guaranteeing they already have an associated (i.e. not anonymous) session then clearly you have to embed the identifying information in the URL itself.

I'd recommend Base64-encoding their name as it'll look like gibberish to inexperienced users ("Ryan" is "?Unlhbg%3D%3D"). Then URI-decode and Base64-decode it and set the text on the widget.

For a very simple example, if the widget contents were like:

Hi there, <span data-field-echo="FirstName"></span>

and the document URL is

https://www.example.com/mypage.html?Unlhbg%3D%3D‍

then the JS would be

document.querySelector("[data-field-echo='FirstName']").textContent = atob(decodeURIComponent(document.location.search.substring(1)));

Obviously the more complex the potential query params, the more precise the code needs to be. If you need more, don't try to write your own URL parser as you'll get it wrong (everyone does!). Use something like URI.js instead.