array CStatEvent::AddCurrent( string event1, string event2 = "", string event3 = "", mixed money = "", string currency = "", string goto = "", string chargeback = "N", mixed site_id = false )
The method AddCurrent adds an event by the parameters of the current visitor. If no event type with identifiers event1, event2 exists, it will be automatically created.
| Parameter | Description |
|---|---|
| event1 | event1 event type identifier. |
| event2 | event2 event type identifier. |
| event3 | The event auxiliary parameter event3. |
| money | Amount of money. |
| currency | Three-character currency identifier. Currency identifiers are defined in the Currencies module. |
| goto | Address of the page the visitor want to open. Commonly used in scripts like /bitrix/redirect.php, that redirect visitors to other pages and register the required event. |
| chargeback | Indicates a negative amount ("N"). Used in
situations when a chargeback event occurs. Possible values:
|
| site_id | The ID of the site with which the new event will be associated. |
Returns an array in the following format:
Array
(
[TYPE_ID] => the event type ID
[EID] => the ID of the new event
)
<?
// register an event of the type
// "Special page views" (view/special_page)
CStatEvent::AddCurrent("softkey",
"out",
$GLOBALS["APPLICATION"]->GetCurPage());
?>
<? // register an event of the type // "Redirect to Softkey payment page" (softkey/out) // if it does not exist, it will be created // register the event using the current visitor parameters // this variable can contain page to redirect to $goto = "http://www.softkey.ru/catalog/basket.php?prodid=902&" "quantity=1&referer1=ritlabs_site&" "referer2=BITRIX_SM.OTk1LjgyLk4wLjI1Lk4ucnU%3D"; CStatEvent::AddCurrent("softkey", "out", "", "", "", $goto); ?>
<?
// register an event of the type
// "CHM file download" (download/manual)
// if it does not exist, it will be created
// register the event using the current visitor parameters
// check if the current visitor tried to download the file
// within the last hour
// get the event type ID
$rs = CStatEventType::GetByEvents($event1, $event2);
if ($ar = $rs->Fetch())
{
// get all events of this type for the current visitor
// for the last hour (3600 sec)
$rs = CStatEvent::GetListByGuest($_SESSION["SESS_GUEST_ID"],
$ar["TYPE_ID"], "",
3600);
// if no such event occurred
if (!($ar=$rs->Fetch()))
{
// add the event!
CStatEvent::AddCurrent("download", "manual");
}
}
?>
| © 2001-2005 Bitrix | Bitrix Site Manager - Content Management & Portal Solutions |