Link URL's using email={{contact.email}} parameter in emails

Hi,

Hubspot started translating the “@” in the email address to the html equivalent “%40”, previously the URL contained the users email address in the URL with the “@” character showing.

Where we own the digital asset in the link URL we have created a translation which works fine. However we send users to third party systems. Is there a way to control the URL configuration and have the “@” show in the email address in the URL again?

Regards,

Mark

Hi @MarkdeLange , I just set up a little test on a page I have but was unable to replicate the behavior you’re seeing. When I click on the link “Click Me!!!” on this page https://www.playtimepottery.net/devsupporttest-0-0, I’m seeing that the URL is https://www.playtimepottery.net/contact?email=test@hubspot.com, and is not being encoded. Are there any steps I can take to replicate the behavior you’re seeing on your site? I link to your page might be helpful as well.

Hi Connor,

I have issues in emails links (rather than in landing pages). Here is a link to an email where I have the problem: Edit Email | HubSpot

The code is at the bottom of the email behind the button “Acceso al curso” or the link text “siguiente enlace”.

Regards,

Mark

Hi @MarkdeLange , I’m still not seeing the issue in the URL or in the form when clicking on that link in your email when sending it to myself as a test: Screenshot by Lightshot

Conner,

This is odd, everytime I do this the “@” is translated to “%40” in the email address (see image below)
Email_link.png

Regards,

Mark

Hi Conner,

apart from the issue with the “@” in {{contact.email}} we are having similar issues with Spanish characters in {{contact.firstname}} and {{contact.lastname}} which are translated to html: “ñ” and the accents like á, é, í, ó, ú, ü, See image below where í and é have converted to html

.
Spanish_chracter.png

Is there a way this can be controlled when we output the infrmation in a URL in the way stated?

Regards,

Mark

Hi @MarkdeLange , how are you displaying this info? Are you sending folks to a URL with those properties as query parameters, then taking the query parameters via JavaScript and putting them into the input fields? I want to test just as you are so that there’s no difference in tests.

Also, can you please let me know what browser you’re using and which email client you’re testing with?

Hi Connor,

The data is sent via the URL, I am not sure how the parameters are picked up. what i do know is that the URL contains the html equivalent of these characters,

The code which picks up the parameters in the link is like: https://domain.com?email={{contact.email}}&firstname={{contact.firstname}}&lastname={{contact.lastname}}

The URL which includes html translations like https://domain.com?email=*********%40gmail.com&firstname=***&lastname=********%2520****%25C3%2591*

This converted characters flow into form fields(same nomenclature) in a web page.

Some time ago we did not have this problem the “@” and Spanish characters did nto get translated to html in this use case.

Regards,

Mark

Hi @MarkdeLange , I just tested out your scenario with the query parameter redirect from an email, then used javascript to pull the query parameters from the URL and change the inputs. I unfortunately was still unable to reproduce your issue. I had an email that redirects to this page, then used JS to pick off the query parameters and change the input values. Here’s my code:

<script>
 hbspt.forms.create({
 portalId: "3430672",
 formId: "2f202145-210f-4633-b17b-2120382ffd29",
 onFormReady: function($form) {
 console.log("ready");
 function getParameterByName(name, url) {
 if (!url) url = window.location.href;
 name = name.replace(/[\[\]]/g, '\\$&');
 var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
 results = regex.exec(url);
 if (!results) return null;
 if (!results[2]) return '';
 return decodeURIComponent(results[2].replace(/\+/g, ' '));
 }
 var firstname = getParameterByName("firstname");
 var lastname = getParameterByName("lastname");
 var email = getParameterByName("email");

 $("input[name='firstname']").val(firstname).change();
 $("input[name='lastname']").val(lastname).change();
 $("input[name='email']").val(email).change();
 }
});
</script>

I believe this is an issue with implementation, rather than an issue with the HubL tokens like {{ contact.name }}.

That said, I actually don’t think this would be too hard to fix for your developer. Basically, on the landing page once they get sent to the form you have set up, all you’ll need to do is decode the URI component so that those characters get displayed properly, rather than being urlencoded. The function is decodeURIcomponent. This will, for example, take a last name like “URRUTIA%20DE%20DIEGO”, and when you run the function on it like this: decodeURIcomponent("URRUTIA%20DE%20DIEGO") , it will just decode those %20 signs and output “URRUTIA DE DIEGO”. This should fix the issue you’re seeing here.

Hi @cbarley I came across this post and I am really hoping you can help us out. We are having a very similar issue and by implementing your code I think we can get there but it is spitting out an error.

This code almost works:

<script>
hbspt.forms.create({
portalId: '******',
formId: '********-*****-****-****-***********',
inlineMessage: 'Thank you! Time to calculate now',
	onFormSubmit: function($form){ setTimeout( function() { 
		var formData = $form.serialize();
		window.location = "https://procobots.com/wp-content/angular-app?" + formData; }, 250 ); // Redirects to url milliseconds. 
		}
		});
</script>

However it is pulling literally ALL form data so then the redirect link goes to a 404. I really only need the email to pass so we can link the two forms data together when they come through the API. Any suggestions?

I believe this is an issue with the URL being encoded on HubSpots end. I’m having an issue with this as well.

Is there a fix for this? I am trying to pass data from HubSpot form completion to a Typeform URL in effort to pre-populate data in Typeform and it does not recognize email with the encoded %40 for an @ symbol.

Are there any updates to this issue?

I want to have a dynamic recipient’s email address populated inside a button URL, for example: https://domain.com?email=\

I tried using {{contact.email}} instead of <user email> but it didn’t work. What is the correct way to do this?