NATS Code Wordpress Plugin

From TMM Wiki
Jump to navigationJump to search
Members Admin
The Members Admin
View Member Details
Add Member
MySQL Auth
Mod Authn DB
Multisite Access
Member Logging
Member Password Retrieval
OpenID Connect
Mod Auth OpenIDC
ID Numbers
NATS Extras
Gallery Builder Module
Remote Affiliate Authentication
Build Your Own Anything Module
Shopping Cart Sales
Moving Tours, Members' Area, and Galleries
Admin Areas
Extended Sales
NATS Code Wordpress Plugin
ATVOD Verification Process
NATS Extras
Remote Affiliate Authentication
Shopping Cart Sales
Moving Tours, Members' Area, and Galleries
Require W-9
Admin Areas
Fraud Report
NATS Content of the Day Module
NATS Load Balancing Module
Gallery Builder Module
Build Your Own Anything Module
NATS Code Wordpress Plugin

The NATS Code Wordpress Plugin lets you use NATS codes in your Wordpress posts. The plugin will replace [nats] in your posts with affiliate NATS codes. As of 0.2.1, it will also work for links in the text widget.

Before relying on this plugin for a live site, please read this entire wiki article for instructions and limitations.

Installing on Wordpress

Download the plugin and extract it into your Wordpress installation's wp-content/plugins/ directory. In Wordpress, go to the Plugins page, look for "NATS Code" in your Inactive Plugins list, and Activate it.

For more information on Wordpress plugin installation, please see the Managing Plugins page.


In Wordpress, go to the Plugins page. Look for "NATS Code" in your Active Plugins list, and Deactivate it.

Note: If you deactivate this plugin, you will probably want to go back and change all the links that use it; otherwise, they will have [nats] in the URL instead of a NATS code.

Configuring the Plugin

On your Settings page, click the "NATS Code" tab. Fill in the default NATS code to use if no other NATS code is available.

The Affiliate Checkbox

Affiliates who send traffic to other people's sites should check the Affiliate box. Program owners who send traffic to their own sites and accept affiliate traffic should leave the Affiliate box unchecked.

Checking the Affiliate box will prevent the plugin from getting NATS codes from the query string. Affiliates won't get any credit for traffic that goes through this blog to the NATS join page.

Site Codes

If you marked the Affiliate checkbox, you can fill in NATS codes to use with this plugin. There are three fields:

  • Short Name - an internal shortname to be used with this NATS code. You will use this shortname to refer to the NATS code in your posts
  • Description - (optional) an internal description of this NATS code. This won't be seen anywhere outside of the admin, and is only to help you keep track of your NATS codes
  • NATS Code - the NATS code to use.

Add new NATS codes by filling in the bottom row of text boxes; then click Add New. Edit codes by changing the fields in one row; click Edit. Delete a code by clicking the Delete button.

Note: If you delete a code that is used in your posts, the plugin will use the default NATS code instead.

Using the Plugin

For Program Owners

For Program Owners that didn't mark the Affiliate checkbox described above.

When you write a link that should pass a NATS Code, insert [nats] as a place holder. For example:

<a href="[nats]">Click Here</a>

The plugin replaces [nats] with the referring affiliate's linkcode when surfers referred by affiliates visit this page. The plugin replaces [nats] with the NATS code you set in the configuration step when surfers find this page on their own. The plugin can also replace [nats] with a custom NATS code when surfers find this page on their own; place the custom NATS code in [nats] separated from nats by a pipe character. For example:

<a href="[nats|Custom_NATS_Code]">Click Here</a>

Program Owners do not have site codes, as there's no way for this plugin to effectively change which site the NATS code is for while keeping the affiliate link. To do that, please see strack, which allows you to switch a surfer's site.

For Affiliates

For Affiliates that marked the Affiliate checkbox described above.

Setting up your site codes in the NATS code section of the settings page.

When you write a link that should pass a NATS Code, insert [nats|site:shortname] as a place holder. For example:

<a href="[nats|site:shortname]">Click Here</a>

Replace shortname with the short name you created on the settings page.

For example: set up a site code with the short name examplesite and with the NATS Code MyDoZwe, and put this in your post:

<a href="[nats|site:examplesite]">Click Here</a>

When they visit your blog using the above example, surfers can click the following link:

<a href="">Click Here</a>

You can also link to a NATS code by entering the NATS code directly. For example:


Replace NATS_CODE with the NATS code you want to use. Note: this has no benefit over simply using the NATS code in the link.

Finally, you can link to the default NATS code by removing all qualifiers. For example:


Warnings regarding use of this Plugin

This plugin was designed to work completely with Wordpress with its default setup.

  • It might not work with specific changes made by your theme
  • It might not work with specific changes made by your plugins
  • It might not work with specific options in future versions of Wordpress
  • It will not make changes to links that are hardcoded in the theme php template files themselves -- use normal PHP code in those links.

After setting up this plugin for use, please confirm that the nats code is indeed being passed correctly through all your links. If there are links it is not being passed through, feel free to put in a support ticket, and we will see if the plugin can be updated to work with those links.

Wordpress Links and Cookies

As of version 0.2.2, the natscode plugin will pass the nats code in all wordpress-generated interlinks (links to the post, links to the categories, etc), if it is not used in Affiliate mode. If no NATS code is being passed in, the default natscode will not be passed from page to page; it will be included when using [nats] to link to external sites.

Note: In case there are links where the nats code is not passed, 0.2.2 also adds a cookie to store the nats code. The main difference is this: if you go to the wordpress with a nats code, and then remove the nats code from your query string, that nats code will still be used. Keep this in mind while testing; to remove the nats code completely, you'll need to remove the "nats" cookie from your browser.

As of version 0.2.3, the natscode plugin also works with links in your blogroll. Because Wordpress strips out [ ] tags in the blogroll, instead put your nats code in link this:


you can still use all the other features, just using NATSCODE instead of [nats]. For example:


Wordpress Caching

We tested this plugin with both wp-cache and wp-super-cache. It creates a separate cache file for each NATS code it receives from surfers; if you get traffic from a lot of different affiliates, generating a cache file for each NATS code may undermine your caching system. Also, if you change the default NATS code or your Site Codes, you must clear your caching plugin's cache.

Wordpress Multiuser

We did not test this plugin with Wordpress Multiuser and it may not work. If you use Wordpress Multiuser and you're willing to help us test an improved version of this plugin, please submit a feature request ticket.

Conflicts with other plugins


If you are using FeedWordpress to syndicate rss feeds, you need to enable filtering syndicated posts.

  • Go to Settings
  • Choose Syndication
  • Look for "Formatting filters" under the "Syndicated Posts" section.
  • From that dropdown, choose "Expose syndicated posts to formatting filters"
  • Click "Save Changes" at the bottom.

If you are using special html (such as embed tags) in your posts, turning this off will kill that data, because of the wpautop filter. To fix that, add and activate the Disable wpautop plugin.

Previous Versions