Difference between revisions of "NATS4 Affiliate Postback"
(22 intermediate revisions by 11 users not shown) | |||
Line 3: | Line 3: | ||
}} | }} | ||
− | + | <font style="color:red;font-weight:bold;">If you are using NATS 4.1.10.1 or higher, please refer to this wiki [[NATS4 Affiliate Postback New]]</font> | |
+ | [[NATS4]] has to ability to post detailed [[Ct#Member|member]] information to your affiliates based on any basic action the member takes through [[NATS]]. This is made possible by using a backend POST, which is based on the basic actions the member takes in NATS. For other postback examples, please check this article: [[NATS4 Postbacks and Post URLs]] | ||
+ | |||
+ | To use this feature, you must first activate it in the [[NATS4 Configuration Admin|Configuration Admin]]. When it is activated, your affiliates will be able to receive detailed information on what actions their members are taking. | ||
==Configuration Admin == | ==Configuration Admin == | ||
− | + | If you would like to enable this feature for your affiliates, go to the [[NATS4 Configuration Admin|Configuration Admin]] and select the "Affiliates" tab from the Current Section drop-down menu. You will then see a list of options to activate under the ''Postbacks'' sub-section. The following is a list of the possible postbacks your affiliates can receive:<br> | |
+ | '''Note: As of NATS v5.0.2.5, these settings are enabled by default''' | ||
+ | |||
+ | * '''AFFILIATE_POSTBACK_MEMBER_APPROVAL'''- Allows affiliates to receive a postback when one of their members signs up. | ||
+ | * '''AFFILIATE_POSTBACK_MEMBER_REBILL'''- Allows affiliates to receive a postback when one of their members rebills. | ||
+ | * '''AFFILIATE_POSTBACK_MEMBER_UPGRADE'''- Allows affiliates to receive a postback when one of their members upgrades their membership. | ||
+ | * '''AFFILIATE_POSTBACK_MEMBER_EXPIRE'''- Allows affiliates to receive a postback when one of their members expires. | ||
+ | * '''AFFILIATE_POSTBACK_MEMBER_INSUFFICIENT_FUND'''- Allows affiliates to receive a postback when one of their members has an "insufficient funds" transaction. | ||
+ | * '''AFFILIATE_POSTBACK_MEMBER_CREDIT'''- Allows affiliates to receive a postback when one of their members receives a credit. | ||
+ | * '''AFFILIATE_POSTBACK_MEMBER_CHARGEBACK'''- Allows affiliates to receive a postback when one of their members initiates a chargeback. | ||
+ | * '''AFFILIATE_POSTBACK_MEMBER_VOID'''- Allows affiliates to receive a postback when one of their members has a void transaction. | ||
+ | * '''AFFILIATE_POSTBACK_MEMBER_UPGRADEDENY'''- Allows affiliates to receive a postback when one of their members upgrade denial. | ||
+ | * '''AFFILIATE_POSTBACK_MEMBER_CHANGE_DETAILS'''- Allows affiliates to receive a postback when one of their members changes their details (such as username/password). | ||
+ | |||
+ | == Affiliate Admin Settings == | ||
+ | |||
+ | Available in NATS 4.1.10.1 and later, NATS allows you to edit Affiliate Admin settings to allow specific postbacks per Affiliate. In the Affiliate admin, click on the "Edit Affiliate Admin Settings" and and you will have the ability to edit the "Postback Settings". | ||
+ | |||
+ | [[Image:AffPostbackSettings.png]] | ||
+ | |||
+ | == Affiliate Configuration == | ||
+ | |||
+ | Once you have activated the postbacks you want your affiliates to be able to receive, your affiliates will be able to login and enter the URL(s) where they want their postback(s) to be sent to. In order to set this, the affiliate needs to go to their "My Account" page, then click the Settings link. | ||
+ | |||
+ | [[Image:My Account Circled.jpg]] | ||
+ | |||
+ | Once on the "Settings" page, you will find 4 tabs. Clicking "Postback Settings" will bring up a new page. On that will look something like the following: | ||
+ | [[Image:AffPostbackScreen.png]] | ||
+ | From there they can enter the URL(s) of the script(s) that will handle their postbacks, the site in which this postback would occur for, the transaction, and the amount format. Depending on which postback type has been configured in the admin, different types may be displayed in the dropdown. | ||
+ | |||
+ | == Postback Format == | ||
+ | |||
+ | We will send the following information in the query string: | ||
{| | {| | ||
|- | |- | ||
− | | ''' | + | |<u>'''Variable Name'''</u> |
− | | | + | |<u>'''Description'''</u> |
+ | |- | ||
+ | |<tt>identid</tt> | ||
+ | | The NATS identifier used to internally associate a member with a campaign, program, site, tour, option, adtool, biller, and country. | ||
+ | |- | ||
+ | |<tt>loginid</tt> | ||
+ | | The numeric NATS loginid for the affiliate receiving the post. | ||
+ | |- | ||
+ | |<tt>status</tt> | ||
+ | | The status of the member that caused the post to trigger. (0 = never joined, 1 = active, 2 = expired) | ||
+ | |- | ||
+ | |<tt>trial</tt> | ||
+ | | Set to 1 if the member who triggered the post is currently marked as a trial member. | ||
+ | |- | ||
+ | |<tt>joined</tt> | ||
+ | | The date the member joined (as a UNIX timestamp). | ||
+ | |- | ||
+ | |<tt>expired</tt> | ||
+ | | The date the member expired in NATS (as a UNIX timestamp). | ||
+ | |- | ||
+ | |<tt>siteid</tt> | ||
+ | | The numeric NATS siteid that the member joined under. | ||
+ | |- | ||
+ | |<tt>statid</tt> | ||
+ | | The numeric NATS statid that links the member to a stat record in the NATS database. | ||
+ | |- | ||
+ | |<tt>billerid</tt> | ||
+ | | The numeric NATS billerid that the member processed their transaction. | ||
+ | |- | ||
+ | |<tt>optionid</tt> | ||
+ | | The numeric NATS optionid that the member joined under. | ||
+ | |- | ||
+ | |<tt>rebills</tt> | ||
+ | | The number of rebills the member has had since joining. | ||
+ | |- | ||
+ | |<tt>expires</tt> | ||
+ | | The date the member is supposed to expire in NATS (as a UNIX timestamp). | ||
+ | |- | ||
+ | |<tt>campaignid</tt> | ||
+ | | The numeric campaignid of which the the member was tracked. | ||
+ | |- | ||
+ | |<tt>campaign_name</tt> | ||
+ | | The alpha-numeric name of which the the member was tracked. | ||
+ | |- | ||
+ | |<tt>programid</tt> | ||
+ | | The numeric programid of which the the member was tracked. | ||
+ | |- | ||
+ | |<tt>tourid</tt> | ||
+ | | The numeric tourid of which the the member was tracked. | ||
+ | |- | ||
+ | |<tt>adtoolid</tt> | ||
+ | | The numeric adtoolid of which the the member was tracked. | ||
+ | |- | ||
+ | |<tt>subid1</tt> | ||
+ | | The numeric subid1 of which the the member was tracked. | ||
+ | |- | ||
+ | |<tt>subid2</tt> | ||
+ | | The numeric subid2 of which the the member was tracked. | ||
+ | |- | ||
+ | |<tt>countryid</tt> | ||
+ | | The numeric countryid of which the the member was tracked. | ||
+ | |- | ||
+ | |<tt>promotionalid</tt> | ||
+ | | The numeric promotionalid of which the the member was tracked. | ||
+ | |- | ||
+ | |<tt>custom1</tt> | ||
+ | | The alpha-numeric custom1 variable assigned to the member. | ||
+ | |- | ||
+ | |<tt>custom2</tt> | ||
+ | | The alpha-numeric custom2 variable assigned to the member. | ||
+ | |- | ||
+ | |<tt>custom3</tt> | ||
+ | | The alpha-numeric custom3 variable assigned to the member. | ||
+ | |- | ||
+ | |<tt>custom4</tt> | ||
+ | | The alpha-numeric custom4 variable assigned to the member. | ||
+ | |- | ||
+ | |<tt>custom5</tt> | ||
+ | | The alpha-numeric custom5 variable assigned to the member. | ||
+ | |- | ||
+ | |<tt>custom6</tt> | ||
+ | | The alpha-numeric custom6 variable assigned to the member. | ||
+ | |- | ||
+ | |<tt>custom7</tt> | ||
+ | | The alpha-numeric custom7 variable assigned to the member. | ||
+ | |- | ||
+ | |<tt>custom8</tt> | ||
+ | | The alpha-numeric custom8 variable assigned to the member. | ||
+ | |- | ||
+ | |<tt>custom9</tt> | ||
+ | | The alpha-numeric custom9 variable assigned to the member. | ||
+ | |- | ||
+ | |<tt>custom10</tt> | ||
+ | | The alpha-numeric custom10 variable assigned to the member. | ||
+ | |- | ||
+ | |<tt>passthrough1</tt> | ||
+ | | The alpha-numeric passthrough1 variable assigned to the member. | ||
|- | |- | ||
− | | | + | |<tt>passthrough2</tt> |
− | | | + | | The alpha-numeric passthrough2 variable assigned to the member. |
|- | |- | ||
− | | | + | |<tt>passthrough3</tt> |
− | | | + | | The alpha-numeric passthrough3 variable assigned to the member. |
|- | |- | ||
− | | | + | |<tt>passthrough4</tt> |
− | | | + | | The alpha-numeric passthrough4 variable assigned to the member. |
|- | |- | ||
− | | | + | |<tt>passthrough5</tt> |
− | | | + | | The alpha-numeric passthrough5 variable assigned to the member. |
|- | |- | ||
− | | | + | |<tt>forced_optionid</tt> |
− | | | + | | The numeric forced_optionid that the member joined under. |
|- | |- | ||
− | | | + | |<tt>default_optionid</tt> |
− | | | + | | The numeric defaulted_optionid presented to the member. |
|- | |- | ||
− | | | + | |<tt></tt> |
− | | | + | | |
|- | |- | ||
− | | ''' | + | |<tt></tt> |
− | | | + | | |
+ | |- | ||
+ | |<tt><u>'''Additional parameter'''</u></tt> | ||
+ | | (available in NATS versions 4.1.7.1 and later) | ||
+ | |- | ||
+ | |<tt>amount</tt> | ||
+ | | The dollar amount that the affiliate earned for this member's signup. | ||
+ | |<tt></tt> | ||
+ | | | ||
|- | |- | ||
− | |||
− | |||
|} | |} | ||
+ | == Postback Logging Script == | ||
+ | The following example script allows you to log any [[NATS4 Affiliate Postback|Postbacks]] sent by [[NATS]] to your User Management script. This script will take any information being posted to the user management script, and store it in a specified log file. In order for this script to work, you must first make your user management log file writable by Apache. To do so, you must change the ''/path/to/nats4/user_management.log'' path found in the following sample script to where your NATS4 ''user_management.log'' file is located. | ||
− | + | '''NOTE''': Make sure that the log is NOT in a web accessible folder. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | <pre> | |
+ | <? | ||
+ | /** Adding a date to the first value. **/ | ||
+ | $message = '[' . date('Y-m-d H:i:s') . '] '; | ||
+ | /** Looping through all request variables. If it is an array, we loop within. **/ | ||
+ | foreach ($_REQUEST as $key => $val) { | ||
+ | /** Add what the value is, what the name is. **/ | ||
+ | if (is_array($val)) { | ||
+ | foreach ($val as $val_key => $val_val) $message .= "&{$key}[{$val_key}]={$val_val}"; | ||
+ | } | ||
+ | else $message .= "&{$key}={$val}"; | ||
+ | } | ||
+ | /** Adding a return message to the log **/ | ||
+ | $message .= "\n"; | ||
+ | /** Adding the log to the specified file **/ | ||
+ | error_log($message, 3, '/path/to/nats4/user_management.log'); | ||
+ | /** Respond NOTOK so the User Management call isn't triggered **/ | ||
+ | echo 'NOTOK'; | ||
+ | |||
+ | ?> | ||
+ | </pre> | ||
[[Category:NATS4 Administrator Guide]] | [[Category:NATS4 Administrator Guide]] | ||
+ | [[Category:NATS4 Configuration Admin]] |
Latest revision as of 12:27, 28 May 2020
If you are using NATS 4.1.10.1 or higher, please refer to this wiki NATS4 Affiliate Postback New
NATS4 has to ability to post detailed member information to your affiliates based on any basic action the member takes through NATS. This is made possible by using a backend POST, which is based on the basic actions the member takes in NATS. For other postback examples, please check this article: NATS4 Postbacks and Post URLs
To use this feature, you must first activate it in the Configuration Admin. When it is activated, your affiliates will be able to receive detailed information on what actions their members are taking.
Configuration Admin
If you would like to enable this feature for your affiliates, go to the Configuration Admin and select the "Affiliates" tab from the Current Section drop-down menu. You will then see a list of options to activate under the Postbacks sub-section. The following is a list of the possible postbacks your affiliates can receive:
Note: As of NATS v5.0.2.5, these settings are enabled by default
- AFFILIATE_POSTBACK_MEMBER_APPROVAL- Allows affiliates to receive a postback when one of their members signs up.
- AFFILIATE_POSTBACK_MEMBER_REBILL- Allows affiliates to receive a postback when one of their members rebills.
- AFFILIATE_POSTBACK_MEMBER_UPGRADE- Allows affiliates to receive a postback when one of their members upgrades their membership.
- AFFILIATE_POSTBACK_MEMBER_EXPIRE- Allows affiliates to receive a postback when one of their members expires.
- AFFILIATE_POSTBACK_MEMBER_INSUFFICIENT_FUND- Allows affiliates to receive a postback when one of their members has an "insufficient funds" transaction.
- AFFILIATE_POSTBACK_MEMBER_CREDIT- Allows affiliates to receive a postback when one of their members receives a credit.
- AFFILIATE_POSTBACK_MEMBER_CHARGEBACK- Allows affiliates to receive a postback when one of their members initiates a chargeback.
- AFFILIATE_POSTBACK_MEMBER_VOID- Allows affiliates to receive a postback when one of their members has a void transaction.
- AFFILIATE_POSTBACK_MEMBER_UPGRADEDENY- Allows affiliates to receive a postback when one of their members upgrade denial.
- AFFILIATE_POSTBACK_MEMBER_CHANGE_DETAILS- Allows affiliates to receive a postback when one of their members changes their details (such as username/password).
Affiliate Admin Settings
Available in NATS 4.1.10.1 and later, NATS allows you to edit Affiliate Admin settings to allow specific postbacks per Affiliate. In the Affiliate admin, click on the "Edit Affiliate Admin Settings" and and you will have the ability to edit the "Postback Settings".
Affiliate Configuration
Once you have activated the postbacks you want your affiliates to be able to receive, your affiliates will be able to login and enter the URL(s) where they want their postback(s) to be sent to. In order to set this, the affiliate needs to go to their "My Account" page, then click the Settings link.
Once on the "Settings" page, you will find 4 tabs. Clicking "Postback Settings" will bring up a new page. On that will look something like the following:
From there they can enter the URL(s) of the script(s) that will handle their postbacks, the site in which this postback would occur for, the transaction, and the amount format. Depending on which postback type has been configured in the admin, different types may be displayed in the dropdown.
Postback Format
We will send the following information in the query string:
Variable Name | Description | ||
identid | The NATS identifier used to internally associate a member with a campaign, program, site, tour, option, adtool, biller, and country. | ||
loginid | The numeric NATS loginid for the affiliate receiving the post. | ||
status | The status of the member that caused the post to trigger. (0 = never joined, 1 = active, 2 = expired) | ||
trial | Set to 1 if the member who triggered the post is currently marked as a trial member. | ||
joined | The date the member joined (as a UNIX timestamp). | ||
expired | The date the member expired in NATS (as a UNIX timestamp). | ||
siteid | The numeric NATS siteid that the member joined under. | ||
statid | The numeric NATS statid that links the member to a stat record in the NATS database. | ||
billerid | The numeric NATS billerid that the member processed their transaction. | ||
optionid | The numeric NATS optionid that the member joined under. | ||
rebills | The number of rebills the member has had since joining. | ||
expires | The date the member is supposed to expire in NATS (as a UNIX timestamp). | ||
campaignid | The numeric campaignid of which the the member was tracked. | ||
campaign_name | The alpha-numeric name of which the the member was tracked. | ||
programid | The numeric programid of which the the member was tracked. | ||
tourid | The numeric tourid of which the the member was tracked. | ||
adtoolid | The numeric adtoolid of which the the member was tracked. | ||
subid1 | The numeric subid1 of which the the member was tracked. | ||
subid2 | The numeric subid2 of which the the member was tracked. | ||
countryid | The numeric countryid of which the the member was tracked. | ||
promotionalid | The numeric promotionalid of which the the member was tracked. | ||
custom1 | The alpha-numeric custom1 variable assigned to the member. | ||
custom2 | The alpha-numeric custom2 variable assigned to the member. | ||
custom3 | The alpha-numeric custom3 variable assigned to the member. | ||
custom4 | The alpha-numeric custom4 variable assigned to the member. | ||
custom5 | The alpha-numeric custom5 variable assigned to the member. | ||
custom6 | The alpha-numeric custom6 variable assigned to the member. | ||
custom7 | The alpha-numeric custom7 variable assigned to the member. | ||
custom8 | The alpha-numeric custom8 variable assigned to the member. | ||
custom9 | The alpha-numeric custom9 variable assigned to the member. | ||
custom10 | The alpha-numeric custom10 variable assigned to the member. | ||
passthrough1 | The alpha-numeric passthrough1 variable assigned to the member. | ||
passthrough2 | The alpha-numeric passthrough2 variable assigned to the member. | ||
passthrough3 | The alpha-numeric passthrough3 variable assigned to the member. | ||
passthrough4 | The alpha-numeric passthrough4 variable assigned to the member. | ||
passthrough5 | The alpha-numeric passthrough5 variable assigned to the member. | ||
forced_optionid | The numeric forced_optionid that the member joined under. | ||
default_optionid | The numeric defaulted_optionid presented to the member. | ||
Additional parameter | (available in NATS versions 4.1.7.1 and later) | ||
amount | The dollar amount that the affiliate earned for this member's signup. |
Postback Logging Script
The following example script allows you to log any Postbacks sent by NATS to your User Management script. This script will take any information being posted to the user management script, and store it in a specified log file. In order for this script to work, you must first make your user management log file writable by Apache. To do so, you must change the /path/to/nats4/user_management.log path found in the following sample script to where your NATS4 user_management.log file is located.
NOTE: Make sure that the log is NOT in a web accessible folder.
<? /** Adding a date to the first value. **/ $message = '[' . date('Y-m-d H:i:s') . '] '; /** Looping through all request variables. If it is an array, we loop within. **/ foreach ($_REQUEST as $key => $val) { /** Add what the value is, what the name is. **/ if (is_array($val)) { foreach ($val as $val_key => $val_val) $message .= "&{$key}[{$val_key}]={$val_val}"; } else $message .= "&{$key}={$val}"; } /** Adding a return message to the log **/ $message .= "\n"; /** Adding the log to the specified file **/ error_log($message, 3, '/path/to/nats4/user_management.log'); /** Respond NOTOK so the User Management call isn't triggered **/ echo 'NOTOK'; ?>