Integration

Download

Download the Mapp Intelligence tracking library from our github repository mapp-digital/mapp-intelligence-tracking and add the tracking library in your PHP code:

require_once __DIR__ . '/path/to/mapp-intelligence/lib/MappIntelligence.php';
PHP

Composer

$ composer require mapp-digital/mapp-intelligence-tracking
BASH

Configuration

$mappIntelligenceConfig = new MappIntelligenceConfig();
$mappIntelligenceConfig->setTrackId("111111111111111")
	->setTrackDomain("analytics01.wt-eu02.net")
	->setDomain(array())
	->addDomain("")
	->setUseParamsForDefaultPageName(array())
	->addUseParamsForDefaultPageName("")
	
	->setLogger(null)
	->setDebug(false)
	->setDeactivate(false)
	
	->setConsumerType("")
	->setConsumer(null)
	->setFilename("/tmp/MappIntelligenceRequests.log")
	->setFilePath("/tmp/")
	->setFilePrefix("MappIntelligenceRequests")
	->setMaxAttempt(1)
	->setAttemptTimeout(100)
	->setMaxBatchSize(50)
	->setMaxQueueSize(1000)
	->setMaxFileLines(10000)
    ->setMaxFileDuration(30 * 60 * 1000)
    ->setMaxFileSize(24 * 1024 * 1024)
	->setForceSSL(true)
	
	->setUserAgent("")
	->setRemoteAddress("")
	->setReferrerURL("")
	->setRequestURL("")
	->setCookie(array())
	->addCookie("", "");
PHP
MethodsTypeNotesDefaultMandatory
setTrackIdStringEnter your Mapp Intelligence track ID (provided by Mapp).emptyyes
setTrackDomainStringEnter your Mapp Intelligence tracking URL.emptyyes
setDomainString[]Specify the domains you do not want to identify as an external referrer (e.g. your subdomains).

$_SERVER['HTTP_HOST']

no
addDomainStringSpecify the domain you do not want to identify as an external referrer (e.g. your subdomains).emptyno
setUseParamsForDefaultPageNameString[]Includes specific URL parameter(s) in the default page name.emptyno
addUseParamsForDefaultPageNameStringIncludes specific URL parameter(s) in the default page name.emptyno
setLoggerMappIntelligenceLoggerActivates the debug mode. The debug mode sends messages your own LoggerClass (see MappIntelligenceLogger).nullno
setDebugBooleanActivates the debug mode. The debug mode sends messages to PHP's system logger, using the Operating System's system logging mechanism or a file, depending on what the error_log configuration directive is set to.falseno
setDeactivateBooleanDeactivate the tracking functionality.falseno
setConsumerTypeStringSpecify the consumer to use for data transfer to Intelligence (CURL, FORK_CURL, FILE, FILE_ROTATION or CUSTOM).CURLno
setConsumerMappIntelligenceConsumerSpecify the custom consumer for data transfer to Intelligence (see MappIntelligenceConsumer).nullno
setFilenameStringEnter the path to your request logging file. This is only relevant when using FILE consumer.sys_get_temp_dir() . '/MappIntelligence
Requests.log'
no
setFilePathStringEnter the path to your request logging file. This is only relevant when using FILE_ROTATION consumer.sys_get_temp_dir() . '/'no
setFilePrefixStringEnter the prefix from your request logging files. This is only relevant when using FILE_ROTATION consumer.MappIntelligenceRequestsno
setMaxAttemptIntegerSpecify the number of resend attempts. After the maxAttempts have been reached, the requests will be deleted even if the sending failed.1no
setAttemptTimeoutIntegerSpecify the interval of request resend in milliseconds.100no
setMaxBatchSizeIntegerSpecify the maximum request number per batch.50no
setMaxQueueSizeIntegerSpecify the maximum number of requests saved in the queue.1000no
setMaxFileLinesIntegerThe maximum number of lines per file.10 * 1000no
setMaxFileDurationIntegerThe maximum file duration.30 * 60 * 1000no
setMaxFileSizeIntegerThe maximum number of maximal file size.24 * 1024 * 1024no
setForceSSLBooleanSends every request via SSL.trueno
setUserAgentStringEnter the origin client HTTP user agent string.$_SERVER['HTTP_USER_AGENT']no
setRemoteAddressStringEnter the origin client Remote address (ip).$_SERVER['REMOTE_ADDR']no
setReferrerURLStringEnter the origin client HTTP referrer URL.$_SERVER['HTTP_REFERER']no
setRequestURLStringEnter the origin client HTTP request URL."https://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']no
setCookieString[]Enter a array of all origin client cookies.$_COOKIEno
addCookieStringEnter a origin client cookie (key, value).emptyno
$mappIntelligenceConfig = new MappIntelligenceConfig(
	"path/to/your/config/file/config.ini"
);
PHP
[tracking]
trackId="111111111111111"
trackDomain="analytics01.wt-eu02.net"
deactivate=false
domain[]="sub.domain.tld"
useParamsForDefaultPageName[]="aa"
useParamsForDefaultPageName[]="bb"
useParamsForDefaultPageName[]="cc"

[debugging]
debug=false

[consumer]
consumerType="FILE_ROTATION"
filePath=""
filePrefix=""
maxAttempt=1
attemptTimeout=100
maxBatchSize=50
maxQueueSize=1000
maxFileLines=10000
maxFileDuration=1800000
maxFileSize=25165824
forceSSL=true
TEXT