The new NATS4 Includes Admin provides an intuitive interface for including a NATS template in another PHP file and using simple programming logic to determine exactly what a surfer sees.
Skins and Templates Admin
Before you can use an include, you need to create a template. Go to Skins and Templates Admin under the Special Templates section. You must select "chaininclude_" as the prefix. (For example: "chaininclude_my_template".) In the header drop-down, select, "No Header"; in the footer drop-down, select, "No Footer." Enter a description and click the Create button.
On the next page, enter into the template body the HTML you want included. Click Save Template.
To continue configuring your new include, go to the Includes Admin. At the bottom of the Include Chains table, there will be a set of blank fields that you can fill in to create your new include. Fill in the chain name and select the default template you want to use. You can also change the tour and the program encoded in the linkcode, whether you want to track a surfer's actions, and decide if you want to enable your new Include Chain. Resetting the surfer's tracking cookie will count the surfer as a unique hit every time they view your new include.
Click the View Rules (Purple Arrows) Icon to change the rules that determine who sees this include chain. Includes Admin rules follow the standard NATS hierarchy. A Hide rule will override all matching show rules, and a show rule will include the file even if you mark the include chain as disabled. NATS will automatically skip all Ignore rules.
Enter the rule's criteria, such as affiliate, program, tour, etc. Only one affiliate's name can be in the Affiliate box, so if you would like to match more than one affiliate you must create an additional rule. You can enter any value PHP's strtotime function can parse into the Start Date & Time and End Date & Time boxes.
NATS evaluates these rules every time a surfer requests a page from this chain, so you can enter recurring times in the Start Time and End Time fields. For example, you can start a rule on Saturday and end it on Monday to only match during weekends. When you are done configuring your rule, click "Save Rule".
Click the View Steps (magnifying glass) icon to change this include chain's steps or add new steps. The template drop-downs let you show a different template than the Default Template, while the Tour Change and Program Change drop-downs override the chain's default Tour and Program changes. The Track button records a new hit every time this a surfer loads this include, the Don't Track button never records a new hit, and the Don't Change button uses the Set Tracking Cookie setting. The value of the URL field is passed to the included template; you can use it with the following Smarty variable:
On any web server that supports PHP, you can create a new web page and enter at least the following code. (Note: if your included file is only a HTML fragment, you need to add your own HTML header and footer.)
<?php include('http://linkdomain/include.php/linkcode/chainid/tpl/orderid/track'); ?>
|chainid||0 or any chain ID number||0 (uses the lowest-numbered enabled chain or the lowest-numbered chain with a matching show rule and no matching hide rule)||chainid=2 (use chain number two)|
|tpl||0 or the name of a chaininclude_ template||0 (show the step's default template)||tpl=chaininclude_my_other_template|
|orderid*||0 or the number of any step in this chain||0 (show the first step)||orderid=7|
|track||0, true, or false||0 (use the default tracking setting)||track=true (track this hit as a unique)|
* Notes: The orderid is not the same as the stepid displayed in the Includes Admin. The orderid is the numerical order of the steps displayed in the Includes Admin for the given chain.
Appendix: Using the Surfer's Session's Linkcode
In your PHP include statement, you should send the surfer's linkcode. If the surfer doesn't have a linkcode, you should send the site's default NATS code. The following code will try to send the surfer's linkcode, but if the surfer doesn't have a linkcode, it will send the default linkcode. You need to replace the word natscode in the following example with your site's default natscode.
<?php $nats = $_REQUEST['nats']?$_REQUEST['nats']:'natscode'; include ('http://linkdomain/include.php/'.$nats); ?>
If you are changing the site or program inside of the chain then you must use strack in your links to switch the tracking. The $switch array will contain the following information for your new site/program:
When using strack you'll only need to utilize $switch.programid and $switch.siteid, however, all the other variables are provided as well.
- strtotime -- the PHP function that parses the Date & Time fields. Note: NATS uses strtotime so that it can take a special "NEVER" parameter.