# How can we help?

## Overview

The `data-crdl-linkappend` attribute can be used to define link append values unique to each HTML element of your document object model, and have them cascade to links based on different levels of elements they are contained within. The attribute can be used in combination with the [default link append feature](https://support.cordial.com/hc/en-us/articles/360036016771) to add URL string values to links in any section of your message content.

Example of appending **articles="true"** key/value pair to links within the `<div>` element:

```html
<div data-crdl-linkappend-articles="true">
```

Link appends defined with the `crdl-linkappend` attribute are appended to the account level default link append string.

Use this attribute to segment link tracking by author - when linking to multiple publications in the same message, filter out link traffic based on unique content section ID values and to overwrite any of the default link append values.

## Our example

For our example, let’s assume that default link append values at the account level have been set to generate the following URL string for all links in a message:

```html
utm_medium=email&utm_campaign=Monthly_Deals
```

In the HTML of our message, we are also including a contact variable for the loyalty attribute, to track link traffic based on loyalty tier levels.

```html
<html>

{$loyalty = $contact.loyalty|default:'undefined'}

<body data-crdl-linkappend-loyalty_tier="{$loyalty}" data-crdl-linkappend-section="mainbody">
   <div id="banner">
      <div>
         <a href="http://example.com">Link 1</a>
      </div>
   </div>
   <div id="articles" data-crdl-linkappend-articles="true">
      <div>
         <a href="http://example.com">Link 2</a><br>
         <a href="http://example.com" data-crdl-noappend="true">Link 3</a>
      </div>
   </div>
   <div id="footer" data-crdl-linkappend-section="footer">
      <div>
         <a href="http://example.com">Link 4</a>
      </div>
   </div>
</body>
</html>
```

### Link 1

Will be appended with the default link append URL string and inherit values for contact loyalty attribute and section name passed by `data-crdl-linkappend` in the `<body>` element:

```
http://example.com/?utm_medium=email&utm_campaign=Monthly_Deals&loyalty_tier=silver&section=mainbody
```

The default value where the loyalty attribute is not set will be set to `undefined`.

### Link 2

Will be appended with the default link append URL string along with values for the contact loyalty attribute and section names passed by `data-crdl-linkappend` in the `<body>` element and “articles” `<div>` element:

```
http://example.com/?utm_medium=email&utm_campaign=Monthly_Deals&loyalty_tier=silver&section=mainbody&articles=true
```

### Link 3

Will not be appended due to the use of `data-crdl-noappend` attribute within the `<a>` tag:

```
http://example.com
```

### Link 4

Will be appended with the default link append URL string along with values for the contact loyalty attribute and section name passed by `data-crdl-linkappend` in the `<footer>` element:

```
http://example.com/?utm_medium=email&utm_campaign=Monthly_Deals&loyalty_tier=silver&section=footer
```

Link 4 inherits the “footer” section value from its parent `<div>` element. Since this is a more immediate parent element to link 4, its value for the section key takes precedence over the `<body>` element section key.

## Overwrite default append values

You can use the `data-crdl-linkappend` attribute to overwrite any of the default link append values set at the account level. Simply match the default append key you wish to overwrite when constructing the attribute.

Replace the default append value for the **utm_campaign** key from our example:

```
data-crdl-linkappend-utm_campaign="affiliateProgram"
```

The `utm_campaign` value will change from "Monthly_Deals" to “affiliateProgram” for links where the above link append attribute is applicable.
