\FACTFinder\AdapterTracking

This tracking adapter uses the new Tracking Interface for 6.11

The adapter classes could conceivably be placed in the \Core\Server namespace, but that would potentially discourage fiddling with and extending these classes. The adapters are main components of the external API of this library. Most other classes are just used to make the adapters work.

Summary

Methods
Properties
Constants
__construct()
getError()
getStackTrace()
doTrackingFromRequest()
setupTrackingFromRequest()
trackClick()
setupClickTracking()
trackCart()
setupCartTracking()
trackCheckout()
setupCheckoutTracking()
trackRecommendationClick()
setupRecommendationClickTracking()
trackLogin()
setupLoginTracking()
applyTracking()
No public properties found
No constants found
usePassthroughResponseContentProcessor()
useJsonResponseContentProcessor()
useXmlResponseContentProcessor()
useResponseContentProcessor()
getResponseContent()
convertServerQueryToClientUrl()
isValidResponse()
$configuration
$request
$parameters
$urlBuilder
$upToDate
N/A
No private methods found
$log
$responseContentProcessor
$lastResponse
$responseContent
$error
$stackTrace
N/A

Properties

$parameters

$parameters : \FACTFinder\Adapter\FACTFinder\Util\Parameters

Type

\FACTFinder\Adapter\FACTFinder\Util\Parameters

$upToDate

$upToDate : boolean

Type

boolean

$log

$log : \FACTFinder\Adapter\FACTFinder\Util\LoggerInterface

Type

\FACTFinder\Adapter\FACTFinder\Util\LoggerInterface

$responseContentProcessor

$responseContentProcessor : \FACTFinder\Util\ContentProcessorInterface

Type

\FACTFinder\Util\ContentProcessorInterface

$responseContent

$responseContent : object

Type

object — The processed response content.

$error

$error : string

Type

string — The last error message.

$stackTrace

$stackTrace : string

Type

string — The last stack trace.

Methods

__construct()

__construct(string  $loggerClass, \FACTFinder\Core\ConfigurationInterface  $configuration, \FACTFinder\Core\Server\Request  $request, \FACTFinder\Core\Client\UrlBuilder  $urlBuilder, \FACTFinder\Core\AbstractEncodingConverter  $encodingConverter = null) 

Parameters

string $loggerClass

Class name of logger to use. The class should implement FACTFinder\Util\LoggerInterface.

\FACTFinder\Core\ConfigurationInterface $configuration

Configuration object to use.

\FACTFinder\Core\Server\Request $request

The request object from which to obtain the server data.

\FACTFinder\Core\Client\UrlBuilder $urlBuilder

Client URL builder object to use.

\FACTFinder\Core\AbstractEncodingConverter $encodingConverter

Encoding converter object to use

getError()

getError() : string

Returns a message if an error occurred.

Returns

string

getStackTrace()

getStackTrace() : string

Returns the stack trace if an error occurred.

Returns

string

doTrackingFromRequest()

doTrackingFromRequest(string  $sid = null, string  $userId = null) : boolean

If all needed parameters are available at the request like described in the documentation, just use this method to fetch the needed parameters and track them. Make sure to set a session id if there is no parameter "sid". If this argument is not set or empty and the parameter "sid" is not available, it will try to use session_id() to fetch one.

Parameters

string $sid

session id

string $userId

id of user

Returns

boolean —

Success?

setupTrackingFromRequest()

setupTrackingFromRequest(string  $sid = null, string  $userId = null) 

Use this method directly if you want to separate the setup from sending the request. This is particularly useful when using the MultiCurlRequestFactory.

Parameters

string $sid

session id

string $userId

id of user

trackClick()

trackClick(string  $id, string  $query, integer  $pos, string  $masterId = null, string  $sid = null, string  $cookieId = null, integer  $origPos = -1, integer  $page = 1, float  $simi = 100.0, string  $title = '', integer  $pageSize = 12, integer  $origPageSize = -1, string  $userId = null, string  $campaign = null, boolean  $instoreAds = false) : boolean

Track a detail click on a product.

Parameters

string $id

tracking id of product (see field with the role "Product number for tracking")

string $query

query which led to the product

integer $pos

position of product in the search result

string $masterId

master id of the product (see field with the role "Master article number")

string $sid

session id (if empty, then try to set using the function session_id() )

string $cookieId

cookie id (optional)

integer $origPos

original position of product in the search result. this data is delivered by FACT-Finder (optional - is set equals to $position by default)

integer $page

page number where the product was clicked (optional - is 1 by default)

float $simi

similiarity of the product (optional - is 100.00 by default)

string $title

title of product (optional - is empty by default)

integer $pageSize

size of the page where the product was found (optional - is 12 by default)

integer $origPageSize

original size of the page before the user could have changed it (optional - is set equals to $page by default)

string $userId

id of user (optional if modul personalisation is not used)

string $campaign

campaign name (optional)

boolean $instoreAds

determines whether it's a sponsered product (optional)

Returns

boolean —

$success

setupClickTracking()

setupClickTracking(  $id,   $query,   $pos,   $masterId = null,   $sid = null,   $cookieId = null,   $origPos = -1,   $page = 1,   $simi = 100.0,   $title = '',   $pageSize = 12,   $origPageSize = -1,   $userId = null,   $campaign = null,   $instoreAds = false) 

Use this method directly if you want to separate the setup from sending the request. This is particularly useful when using the MultiCurlRequestFactory.

Parameters

$id
$query
$pos
$masterId
$sid
$cookieId
$origPos
$page
$simi
$title
$pageSize
$origPageSize
$userId
$campaign
$instoreAds

trackCart()

trackCart(string  $id, string  $masterId = null,   $title = '', string  $query = null, string  $sid = null, string  $cookieId = null, integer  $count = 1, float  $price = null, string  $userId = null, string  $campaign = null, boolean  $instoreAds = false) : boolean

Track a product which was added to the cart.

Parameters

string $id

tracking id of product (see field with the role "Product number for tracking")

string $masterId

master id of the product (see field with the role "Master article number")

$title
string $query

query which led to the product (only if module Semantic Enhancer is used)

string $sid

session id (if empty, then try to set using the function session_id() )

string $cookieId

cookie id (optional)

integer $count

number of items purchased for each product (optional - default 1)

float $price

this is the single unit price (optional)

string $userId

id of user (optional if modul personalisation is not used)

string $campaign

campaign name (optional)

boolean $instoreAds

determines whether it's a sponsered product (optional)

Returns

boolean —

$success

setupCartTracking()

setupCartTracking(  $id,   $masterId = null,   $title = '',   $query = null,   $sid = null,   $cookieId = null,   $count = 1,   $price = null,   $userId = null,   $campaign = null,   $instoreAds = false) 

Use this method directly if you want to separate the setup from sending the request. This is particularly useful when using the MultiCurlRequestFactory.

Parameters

$id
$masterId
$title
$query
$sid
$cookieId
$count
$price
$userId
$campaign
$instoreAds

trackCheckout()

trackCheckout(string  $id, string  $masterId = null,   $title = '', string  $query = null, string  $sid = null, string  $cookieId = null, integer  $count = 1, float  $price = null, string  $userId = null, string  $campaign = null, boolean  $instoreAds = false) : boolean

Track a product which was purchased.

Parameters

string $id

tracking id of product (see field with the role "Product number for tracking")

string $masterId

master id of the product (see field with the role "Master article number")

$title
string $query

query which led to the product (only if module Semantic Enhancer is used)

string $sid

session id (if empty, then try to set using the function session_id() )

string $cookieId

cookie id (optional)

integer $count

number of items purchased for each product (optional - default 1)

float $price

this is the single unit price (optional)

string $userId

id of user (optional if modul personalisation is not used)

string $campaign

campaign name (optional)

boolean $instoreAds

determines whether it's a sponsered product (optional)

Returns

boolean —

$success

setupCheckoutTracking()

setupCheckoutTracking(  $id,   $masterId = null,   $title = '',   $query = null,   $sid = null,   $cookieId = null,   $count = 1,   $price = null,   $userId = null,   $campaign = null,   $instoreAds = false) 

Use this method directly if you want to separate the setup from sending the request. This is particularly useful when using the MultiCurlRequestFactory.

Parameters

$id
$masterId
$title
$query
$sid
$cookieId
$count
$price
$userId
$campaign
$instoreAds

trackRecommendationClick()

trackRecommendationClick(string  $id, integer  $mainId, string  $masterId = null, string  $sid = null, string  $cookieId = null, string  $userId = null) : boolean

Track a click on a recommended product.

Parameters

string $id

tracking id of product (see field with the role "Product number for tracking")

integer $mainId

ID of the product for which the clicked-upon item was recommended

string $masterId

master id of the product (see field with the role "Master article number")

string $sid

session id (if empty, then try to set using the function session_id() )

string $cookieId

cookie id (optional)

string $userId

id of user (optional if modul personalisation is not used)

Returns

boolean —

$success

setupRecommendationClickTracking()

setupRecommendationClickTracking(  $id,   $mainId,   $masterId = null,   $sid = null,   $cookieId = null,   $userId = null) 

Use this method directly if you want to separate the setup from sending the request. This is particularly useful when using the MultiCurlRequestFactory.

Parameters

$id
$mainId
$masterId
$sid
$cookieId
$userId

trackLogin()

trackLogin(string  $sid = null, string  $cookieId = null, string  $userId = null) : boolean

Track login of a user

Parameters

string $sid

session id (if empty, then try to set using the function session_id() )

string $cookieId

cookie id (optional)

string $userId

id of user who logged in

Returns

boolean —

$success

setupLoginTracking()

setupLoginTracking(  $sid = null,   $cookieId = null,   $userId = null) 

Use this method directly if you want to separate the setup from sending the request. This is particularly useful when using the MultiCurlRequestFactory.

Parameters

$sid
$cookieId
$userId

applyTracking()

applyTracking() : boolean

send tracking

Returns

boolean —

$success

usePassthroughResponseContentProcessor()

usePassthroughResponseContentProcessor() 

useJsonResponseContentProcessor()

useJsonResponseContentProcessor() 

useXmlResponseContentProcessor()

useXmlResponseContentProcessor() 

useResponseContentProcessor()

useResponseContentProcessor(object  $callable) 

Pass in a function to process the response content. This method is not used within the library, but may be convenient when writing custom adapters.

Parameters

object $callable

A function (or invokable object) that processes a single string parameter.

Throws

\FACTFinder\Adapter\InvalidArgumentException

if $callable is not callable.

getResponseContent()

getResponseContent() 

convertServerQueryToClientUrl()

convertServerQueryToClientUrl(  $query) 

Parameters

$query

isValidResponse()

isValidResponse(  $jsonData) : boolean

Returns true if the response is valid or false if an error occurred.

Parameters

$jsonData

Returns

boolean