|
|
Line 72: |
Line 72: |
| ?> | | ?> |
| </pre> | | </pre> |
| + | Another example including how to get the linkcode from the PHP request array. Please note you will want to set your own default code instead of MC4wLjUyLjUyLjAuMC4wLjA |
| + | <pre> |
| + | <?php |
| + | $nats = $_REQUEST['nats']?$_REQUEST['nats']:'MC4wLjUyLjUyLjAuMC4wLjA'; |
| + | include ('http://linkdomain/include.php/'.$nats); |
| + | ?> |
| + | </pre> |
| + | |
| | | |
| Replace ''linkdomain'' with your [[Link Domain|linkdomain]] or | | Replace ''linkdomain'' with your [[Link Domain|linkdomain]] or |
Revision as of 13:32, 13 July 2009
The new NATS4 Includes Admin provides an intuitive interface for
including a NATS template in another PHP file and using
simple programing logic to determine exactly what a surfer sees.
The New NATS4 Includes Admin
Skins and Templates Admin
Before you can use an include, you need to create a template. Go to
Skins and Templates Admin, edit the default skin, go to the Create
Template section, and place your cursor in the Name field. Enter the
name of your template prefixed with the term, "chaininclude_". (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.
Includes Admin
Go to Includes Admin, go to the bottom of the Include Chains table,
and fill in the blank Chain Name field. Use the Default Template
drop-down to choose the template you just created. You may change the tour
and the program encoded in the linkcode, reset the
surfer's tracking cookie, and enable this chain. Reseting the surfer's
tracking cookie counts the surfer as a unique hit every time they view
this include.
Click the View Rules (Purple Arrows) Icon to change the rules that
determine who sees this include chain. A matching Hide rule
overrides all matching Show rules. A Show rule includes the file even if
you marked the include chain as disabled. NATS skips all Ignore rules.
Editing Include Chain Rules
Enter the rule's criteria. You can only enter one affiliate's name in the
Affiliate box. Use more than one rule to match more than one affiliate.
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. For example, you can start a
rule on Saturday and end it on Monday to only match during weekends.
Click Add.
Click the View Steps (Magnifier) icon to change this include chain's
steps. The template drop-downs lets you show a different template than
the Default Template. 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:
{$params.url}
Editing Include Chain Steps
Including
On any web server that supports PHP, 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=0/tpl=0/orderid=0/track=0');
?>
Another example including how to get the linkcode from the PHP request array. Please note you will want to set your own default code instead of MC4wLjUyLjUyLjAuMC4wLjA
<?php
$nats = $_REQUEST['nats']?$_REQUEST['nats']:'MC4wLjUyLjUyLjAuMC4wLjA';
include ('http://linkdomain/include.php/'.$nats);
?>
Replace linkdomain with your linkdomain or
domain. Replace linkcode with a linkcode.
The other parameters are optional; the following table describes them.
Parameter
|
Arguments
|
Default
|
Example
|
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)
|
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 with your
site's default natscode.
include 'http://linkdomain/include.php/'.?=$_REQUEST[nats]?$_REQUEST[nats]:natscode.'/chainid=0/tpl=0/orderid=0/track=0';
Changing Site/Program
If you are changing the site or program inside of chain then you must use NATS4_track_and_strack in your links to switch the tracking. The $switch array will contain the following information for your new site/program:
- $switch.programid
- $switch.siteid
- $switch.tourid
- $switch.campaignid
- $switch.adtoolid
- $switch.subid1
- $switch.subid2
When using NATS4_track_and_strack you'll only need to utilize $switch.programid and $switch.siteid, however, all the other variables are provided as well.
See Also
- strtotime -- the PHP function that parses the Date & Time fields. Note: NATS uses strtotime so that it can take a special "NEVER" parameter.