# Insert Merge Code into HREF in Raw HTML Builder

**URL:** <https://integration.keap.com/t/insert-merge-code-into-href-in-raw-html-builder/49667>\
**Category:** Max Classic\
**Tags:** email-builder, html-builder\
**Created:** [August 16, 2018, 3:36pm UTC](https://integration.keap.com/t/insert-merge-code-into-href-in-raw-html-builder/49667 "2018-08-16T15:36:00Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Avery\_Koranda](https://avatars.discourse-cdn.com/v4/letter/a/48db29/32.png) [@Avery\_Koranda](https://integration.keap.com/u/Avery_Koranda)\
**Post date:** [August 16, 2018, 3:36pm UTC](https://integration.keap.com/t/insert-merge-code-into-href-in-raw-html-builder/49667/1 "2018-08-16T15:36:00Z")

</div>

I’m attempting to create a purely HTML email (i.e. NOT using the drag-and-drop builder), and I’m to the point where I need to insert an unsubscribe link at the bottom of my email.

I’ve been trying to MacGyver a solution using a merge code for an Automation Link and just inserting it as plain text (which is typically seen as a hyperlink in the contact’s inbox) as shown below:  
 ![image](https://us1.discourse-cdn.com/flex019/uploads/infusionsoft1/original/2X/c/c7711713d7b4d15c8365fe551333ae5822b4bdd9.png)

The code looks like this:

```auto
<p class="footer-text">To update your email preferences or unsubscribe from this list, click below:
  <br/>
  ~OptOut_21~</p>

```

The problem? It’s a huge ugly link, rather than having a simple, clean look (screenshot from the drag and drop builder):  
 ![image](https://us1.discourse-cdn.com/flex019/uploads/infusionsoft1/original/2X/2/2c27aae6dc2fe86d85c1ffdb3190fbdad42e65d5.png)

I tried this:

```auto
<a href="~OptOut_21~">click here</a>

```

And I get directed to Infusionsoft’s “Page Not Found” when I click that link in a test email.

What am I missing?

Thanks!

---

<div class="post-metadata">

**Author:** ![Candice\_Hiles](https://avatars.discourse-cdn.com/v4/letter/c/e0b2c6/32.png) [@Candice\_Hiles](https://integration.keap.com/u/Candice_Hiles)\
**Post date:** [August 17, 2018, 1:07am UTC](https://integration.keap.com/t/insert-merge-code-into-href-in-raw-html-builder/49667/2 "2018-08-17T01:07:31Z")

</div>

What does the automation link show for the text it is to use in lieu of the actual URL?

---

<div class="post-metadata">

**Author:** ![Avery\_Koranda](https://avatars.discourse-cdn.com/v4/letter/a/48db29/32.png) [@Avery\_Koranda](https://integration.keap.com/u/Avery_Koranda)\
**Post date:** [August 21, 2018, 1:40pm UTC](https://integration.keap.com/t/insert-merge-code-into-href-in-raw-html-builder/49667/3 "2018-08-21T13:40:28Z")

</div>

Thanks for your reply, Candice!

Through an (uncharacteristically) informative conversation with chat support, I learned that the ~OptOut\_21~ code doesn’t work. What I needed to do was go into an email template, convert it to raw HTML, and pull the merge code from the unsubscribe block at the bottom, which reads more like ~Link-615776~.

Interestingly, I tried converting several templates to HTML and each had a unique code. I’m not sure what the implications of this are. However, it seems to do the trick!

---

<div class="post-metadata">

**Author:** ![Dan\_Krebs](https://avatars.discourse-cdn.com/v4/letter/d/ee59a6/32.png) [@Dan\_Krebs](https://integration.keap.com/u/Dan_Krebs)\
**Post date:** [May 31, 2019, 7:38pm UTC](https://integration.keap.com/t/insert-merge-code-into-href-in-raw-html-builder/49667/4 "2019-05-31T19:38:27Z")

</div>

How do you “convert it to raw HTML”? (I’m trying use your found solution)

---

<div class="post-metadata">

**Author:** ![Avery\_Koranda](https://avatars.discourse-cdn.com/v4/letter/a/48db29/32.png) [@Avery\_Koranda](https://integration.keap.com/u/Avery_Koranda)\
**Post date:** [May 31, 2019, 8:44pm UTC](https://integration.keap.com/t/insert-merge-code-into-href-in-raw-html-builder/49667/5 "2019-05-31T20:44:45Z")

</div>

Hey Dan!

To convert a template to HTML, open it up for editing and click “Use Code Builder” like this:

 ![19-05-31-dan-krebs-infusionsoft-question](https://us1.discourse-cdn.com/flex019/uploads/infusionsoft1/original/2X/4/4f46343a292ea45adcc3706c1fa9485378e438be.png)

This will only work on a legacy email template (create one by navigating to Marketing → Templates). If you’ve saved an email to “My Templates” using Infusionsoft’s newer email builder, I don’t know how to get the HTML for that.

Once you’ve opened the screen with the template’s HTML, the link code is toward the bottom:

 ![19-05-31-dan-krebs-infusionsoft-question-2](https://us1.discourse-cdn.com/flex019/uploads/infusionsoft1/original/2X/2/2a5c30e7575dcdb6d6595c92ba61394b20dc99bb.png)

Does that help?

---

<div class="post-metadata">

**Author:** ![Dan\_Krebs](https://avatars.discourse-cdn.com/v4/letter/d/ee59a6/32.png) [@Dan\_Krebs](https://integration.keap.com/u/Dan_Krebs)\
**Post date:** [May 31, 2019, 9:28pm UTC](https://integration.keap.com/t/insert-merge-code-into-href-in-raw-html-builder/49667/6 "2019-05-31T21:28:22Z")

</div>

Yes, that helps! Thanks!! By the way, have you discovered if the unique code, ie. ~Link-615776~ has any signficance or correlates to anything in particular – or if it just works no matter what the number is? The first number I got and tested seems to redirect properly to an unsubscribe page, but I wonder what will happen if I keep using that same code for future email sends… Thanks for any additional insights you’ve gained. – Dan

---

<div class="post-metadata">

**Author:** ![Avery\_Koranda](https://avatars.discourse-cdn.com/v4/letter/a/48db29/32.png) [@Avery\_Koranda](https://integration.keap.com/u/Avery_Koranda)\
**Post date:** [June 3, 2019, 1:06pm UTC](https://integration.keap.com/t/insert-merge-code-into-href-in-raw-html-builder/49667/7 "2019-06-03T13:06:33Z")

</div>

Glad it seems to be working for you!

I am still pretty in the dark as far as the link code goes- my best guess would be that unique codes are used for individual emails to track _which_ email a contact unsubscribes from. So if you use that code, it may look as though any unsubscribes are actually on the template you stole the link from, not on the email you inserted it into.

Again, that’s only my guess- I don’t really have any evidence to back that up. 🙂
