I'm currently installing a few lines of jQuery on several non-hubspot pages. The pages have a hubspot form with a hidden field that the jQuery should automatically populate with the page URL upon form submission.
The URL should then be stored in a contact property called registration_backlink.
Problem:
The logic is to use the contact property called registration_backlink in order to create dynamic buttons in emails so each person is referred to register and submit their details on an updated version of the page they visited before. What's the best way to go about doing this?
An alternative to the whole process would be to enroll contacts into an active list based on the URL they came from and send them an email with smart content based on list city but as we're running hundreds of events we would be running out of active lists!
This is a non-hubspot page, but we use a hubspot form.
The link above is a test-website and may appear as usafe to visit on some browsers
The jQuery we're using for this is:
var getURL = window.location.href; ('.hs_registration_backlink.hs-registration_backlink.hs-fieldtype-text.field.hs-form-field').val(('.hs_registration_backlink.hs-registration_backlink.hs-fieldtype-text.field.hs-form-field').val()+getURL);
Yes so if you are sending an email to the user, you should be able to use a custom property in that email with the URL that they filled out the form on that you set with jquery. So if they filled out the form and their property was properly set, in the email you can use that property by inserting a personalization token the normal way: https://knowledge.hubspot.com/articles/kcs_article/cos-general/how-to-use-personalization-with-your-..., or write in the source code:
{{ contact.internal_name_of_property_here }}. For me that is: {{ contact.url }}
Hi @Connor_Barley thanks for the reply!
Just seen it thanks for that.
That's how I initially coded it but opted for the code I mentioned above as it was suggested to us by our on-boarding HS manager.
However, this ticket is a little different than the previous one. It has to do with dynamic urls for buttons instead of fixed ones. so Click Here! should take contacts to the url in their contact property.
Yes so if you are sending an email to the user, you should be able to use a custom property in that email with the URL that they filled out the form on that you set with jquery. So if they filled out the form and their property was properly set, in the email you can use that property by inserting a personalization token the normal way: https://knowledge.hubspot.com/articles/kcs_article/cos-general/how-to-use-personalization-with-your-..., or write in the source code:
{{ contact.internal_name_of_property_here }}. For me that is: {{ contact.url }}