# nats\_decode

*Article Topics:* [*Smarty*](https://docs.toomuchmedia.com/getting-started/common-topics/smarty)*,* [*Customization*](https://docs.toomuchmedia.com/getting-started/common-topics/customization)

Decodes a [linkcode](https://docs.toomuchmedia.com/using-nats/nats-admin-features/linkcodes) into a [Smarty](https://docs.toomuchmedia.com/using-nats/one-off-articles/smarty) array.

## **Parameters**

(*Required parameters in **bold**)*

| Parameter                                                                                                                                 | Description                                                      | Possible Values                                    | Default Value                        | Example                         |
| ----------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- | -------------------------------------------------- | ------------------------------------ | ------------------------------- |
| **nats**                                                                                                                                  | **The linkcode to be decoded.**                                  | **Any valid linkcode for this NATS installation.** | **None. This parameter is required** | **nats="OC4xLjEuMS4wLjAuMC4w"** |
| assign                                                                                                                                    | Array name to store the decoded linkcode.                        | Any valid Smarty array name                        | decoded                              | assign="myarray"                |
| [assign\_prefix](https://docs.toomuchmedia.com/nats-admin/skins-and-templates/further-reading/template-function-parameters/assign_prefix) | Prefix output variables with this word. (Click link for details) | Any valid Smarty variable name                     | *None.* (No prefix is used)          | assign\_prefix="myvar"          |

## Output

Output is stored in an array with the same structure as the parameters in [nats\_encode](https://docs.toomuchmedia.com/nats-admin/skins-and-templates/further-reading/template-functions/nats_encode). The data here is stored within the *$decoded* array, and contains the following information:

```
loginid => "2"
programid => "18"
siteid => "3"
tourid => "7"
campaignid => "0"
adtoolid => "0"
subid1 => "0"
subid2 => "0"
promotionalid => "0"
is_unencoded => 0
networkid => 0
old_code => 0	
inhouse => "0"
```

The values displayed for each variable in the example above are sample values, which will be replaced with the actual values found in your *$decoded* array.

The *old\_code* variable provided here lets you know whether the code in question was generated in previous versions of NATS. If the code was generated in NATS, it will be displayed as *old\_code=1*, and code generated in NATS will be displayed as *old\_code=0*

## See Also

{% content-ref url="nats\_encode" %}
[nats\_encode](https://docs.toomuchmedia.com/nats-admin/skins-and-templates/further-reading/template-functions/nats_encode)
{% endcontent-ref %}
