C Plug-In Callback Interface
  • 16 Apr 2020
  • 3 Minutes to read
  • Contributors
  • Dark
    Light
  • PDF

C Plug-In Callback Interface

  • Dark
    Light
  • PDF

Article summary

All plug-ins have access to the ResolveName and ApplyTranslation callback functions. The log file fields that can be accessed using the ResolveName function and the modifications that can be performed using the ApplyTranslation function depend on the object that the plug-in works with.

The following sections describe the ResolveName and ApplyTranslation functions which are defined in translate.h file.

ResolveName

Your plug-in can use the ResolveName callback function to request the value of a particular log file object from Webtrends.

Parameters

lpszName
This parameter indicates which part of the log file record the plug-in wants Webtrends to return. The argument lpszName may contain multiple names separated by commas. The first one that resolves is returned. For more information about valid values, see “Parameter Values,” below.

lpDetails
The opaque pointer that is passed to the plug-in’s xltTranslate, XltTranslateVisitorHit, and xltTranslateVisitorSession callback functions.

lpsrResult
The string returned to the plug-in from Webtrends. Because the value may or may not be null-terminated, you should only refer to lpsrResult->GetLength() characters starting at lpsrResult->GetData().

Return Values

XLTOK
The function returns XLTOK if the value identified by the lpszName parameter is returned.

XLTERR
The function returns XLTERR if the value identified by the lpszName parameter is not returned.

Function Specification

int ResolveName (const char *lpszName, void *lpDetails, StringRef
*lpsrResult);

ApplyTranslation

The ApplyTranslation callback function modifies the value of the object requested by the ResolveName function and sends it back to Webtrends to use in the analysis.

Arguments

lpDetails
The opaque pointer that is passed to the plug-in’s xltTranslate, XltTranslateVisitorHit, and xltTranslateVisitorSession functions.

lpszName
The portion of the log file record to act upon.

lpszAction
The action to take. You can replace the value or append to the existing value.

lpszNewString
The value that you want to replace or append to the log file object specified.

Return Values

The ApplyTranslation function returns true if the lpszName is resolved; false if the name cannot be resolved.

Function Specification

int ApplyTranslation(void *lpDetails, const char* lpszName, const char* 
lpszAction, const char* lpszNewString);

Parameter Values

The following tables show the possible values of lpszName, the possible values of lpszAction, and the maximum replacement string length. The values of lpszName (object parameter name) and lpszAction(action parameter name) are not case-sensitive.

xltTranslate Parameters

You can use the following parameter values with the xltTranslate() function.

lpszName ParametersResolveName()ApplyTranslation()Maximum string replacement lengthlpszAction ParametersValid for Basic Analysis Profiles
"url"YesYes"replace"Yes
"urlstem"YesYes"replace"Yes
"urlandparams"YesYes"replace"Yes
"params"YesYesEntire parameter string

"replace" or "append"
Yes
"cookie"YesYesEntire cookie string "replace"Yes
"authuser"YesYes"replace"Yes
"referer"YesYes"replace"Yes
"referrer"YesYes"replace"Yes
"referrer-domain"YesNo"replace"No
"datetime"YesYes"replace"Yes
"host"YesYesLess than 103 characters"replace"Yes
"rawlogline"YesNo"replace"No
"sessionid"YesYesLess than 128 characters"replace"No
"method"YesYes"replace"Yes
"status"YesYes"replace"Yes
"agent"YesYes"replace"Yes
"client"YesYes"replace"Yes
"duration"YesYes"replace"No
"protocol"YesYes"replace"No
"oneparam:name"YesYesSpecify individual parameter name for name "replace"Yes
"onecookie:name"YesYesSpecify individual cookie name for name "replace"Yes
"delparam:name"NoYesSpecify individual parameter name for name "replace"Yes
"delcookie:name"NoYesSpecify individual cookie name for name "replace"Yes
"search-engine"YesNo"replace"No
"search-phrase"YesNo"replace"No

xltTranslateVisitorHit Parameters

The following parameters are valid only for use within the xltTranslateVisitorHit() method.

lpszName ParametersResolveName()ApplyTranslation()lpszAction Parameters
"vr-oneparam:name"YesYesSpecify individual parameter name for name "replace"
"vr-onecookie:name"YesYesSpecify individual cookie name for name "replace"
"vr-delparam:name"NoYesSpecify individual parameter name for name"replace"
"vr-delcookie:name"NoYesSpecify individual cookie name for name "replace"

xltTranslateVisitorSession Parameters

The following parameters are only valid for use within the xltTranslateVisitorSession() function.

lpszName ParametersResolveName()TranslateName()lpszAction Parameters
"datetime"YesNoTime the session occurred
"visittime"YesNoNumber of seconds attributed to the session

Was this article helpful?