# Send JS generated URL per E-Mail

**URL:** <https://community.hubspot.com/t/send-js-generated-url-per-e-mail/18672>\
**Category:** Lists, Lead Scoring & Workflows\
**Tags:** workflows\
**Created:** [February 10, 2020, 9:46am UTC](https://community.hubspot.com/t/send-js-generated-url-per-e-mail/18672 "2020-02-10T09:46:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nikboe](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/nikboe/32/39641_2.png) [@Nikboe](https://community.hubspot.com/u/Nikboe)\
**Post date:** [February 10, 2020, 9:46am UTC](https://community.hubspot.com/t/send-js-generated-url-per-e-mail/18672/1 "2020-02-10T09:46:13Z")

</div>

Hi,

we generate an URL based on a form that is entered with JavaScript, e.g. [https://URL.io/welcome-affiliate?affiliate=company-name](https://lp.briisk.io/welcome-affiliate?affiliate=briisk-ltd%20)

They get send to this URL directly after filling in the form.

Now I would like to send this link per E-Mail as well, but I obviously can’t integrate JavaScript in the E-Mail that is send out.

How can I do that?

Thanks!

---

<div class="post-metadata">

**Author:** ![MikeCormack](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/mikecormack/32/22307_2.png) [@MikeCormack](https://community.hubspot.com/u/MikeCormack)\
**Post date:** [February 10, 2020, 10:03am UTC](https://community.hubspot.com/t/send-js-generated-url-per-e-mail/18672/2 "2020-02-10T10:03:07Z")

</div>

\<a [href=URL.com?affiliate=](http://href=URL.com?affiliate=){{ contact.company\_name }}\>link\</a\>

You may need to put in the %20s into a custom company name field, if so you could have a hidden field and add it in on the fly with some more js

---

<div class="post-metadata">

**Author:** ![Nikboe](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/nikboe/32/39641_2.png) [@Nikboe](https://community.hubspot.com/u/Nikboe)\
**Post date:** [February 10, 2020, 1:03pm UTC](https://community.hubspot.com/t/send-js-generated-url-per-e-mail/18672/3 "2020-02-10T13:03:13Z")

</div>

Thanks for your reply. Though, I am not sure if you understood my problem. Generating the URL isn’t the problem, but implementing it in the E-Mail. As you said I am formatting the company name with JS.

Or did I get you wrong?

---

<div class="post-metadata">

**Author:** ![MikeCormack](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/mikecormack/32/22307_2.png) [@MikeCormack](https://community.hubspot.com/u/MikeCormack)\
**Post date:** [February 11, 2020, 1:20pm UTC](https://community.hubspot.com/t/send-js-generated-url-per-e-mail/18672/4 "2020-02-11T13:20:58Z")

</div>

I am perhaps misunderstanding the question.

The html I sent would go into the source code of a rich text in an email to produce a link that drops the querystring with the company name added via the personalisation field {{ contact.company\_name }} or whatever ythe field is called.

---

<div class="post-metadata">

**Author:** ![Nikboe](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/nikboe/32/39641_2.png) [@Nikboe](https://community.hubspot.com/u/Nikboe)\
**Post date:** [February 11, 2020, 1:28pm UTC](https://community.hubspot.com/t/send-js-generated-url-per-e-mail/18672/5 "2020-02-11T13:28:28Z")

</div>

Thanks for your answer!

I solved the problem:

1) Create a hidden field in the form

2) Use script to populate the form before sending it: $form.find(‘input[name=“affiliate\_id”]’).val(affiliateID).change();

affiliate\_id is the form field, affiliateID ist my variable.
