Integration and Configuration
    • 3 Minutes to read
    • Dark
      Light

    Integration and Configuration

    • Dark
      Light

    Article summary

    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';

    Composer

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

    Configuration

    $mappIntelligenceConfig = new MappIntelligenceConfig();
    $mappIntelligenceConfig->setTrackId("111111111111111")
    	->setTrackDomain("analytics01.wt-eu02.net")
    	->setDomain(array())
    	->addDomain("")
    	->setUseParamsForDefaultPageName(array())
    	->addUseParamsForDefaultPageName("")
    	
    	->setContainsInclude(array())
    	->addContainsInclude("")
    	->setContainsExclude(array())
    	->addContainsExclude("")
    	->setMatchesInclude(array())
    	->addMatchesInclude("")
    	->setMatchesExclude(array())
    	->addMatchesExclude("")
    
    	->setLogger(null)
    	->setLogLevel(MappIntelligenceLogLevel::ERROR)
    	->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("")
    	->setClientHintUserAgent("")
    	->setClientHintUserAgentFullVersionList("")
    	->setClientHintUserAgentMobile("")
    	->setClientHintUserAgentModel("")
    	->setClientHintUserAgentPlatform("")
    	->setClientHintUserAgentPlatformVersion("")
    	->setRemoteAddress("")
    	->setReferrerURL("")
    	->setRequestURL("")
    	->setCookie(array())
    	->addCookie("", "");

    Methods

    Type

    Notes

    Default

    Mandatory

    setTrackId

    String

    Enter your Mapp Intelligence track ID (provided by Mapp).

    empty

    yes

    setTrackDomain

    String

    Enter your Mapp Intelligence tracking URL.

    empty

    yes

    setDomain

    String[]

    Specify the domains you do not want to identify as an external referrer (e.g. your subdomains).

    $_SERVER['HTTP_HOST']

    no

    addDomain

    String

    Specify the domain you do not want to identify as an external referrer (e.g. your subdomains).

    empty

    no

    setUseParamsForDefaultPageName

    String[]

    Includes specific URL parameter(s) in the default page name.

    empty

    no

    addUseParamsForDefaultPageName

    String

    Includes specific URL parameter(s) in the default page name.

    empty

    no

    setContainsInclude

    String[]

    Specify the strings that must be contained in the request URL to measure the request.

    empty

    no

    addContainsInclude

    String

    Specify the string that must be contained in the request URL to measure the request.

    empty

    no

    setContainsExclude

    String[]

    Specify the strings that must be contained in the request URL to not measure the request.

    empty

    no

    addContainsExclude

    String

    Specify the string that must be contained in the request URL to not measure the request.

    empty

    no

    setMatchesInclude

    String[]

    Specify the regular expressions that must be match the request URL to measure the request.

    empty

    no

    addMatchesInclude

    String

    Specify the regular expression that must be match the request URL to measure the request.

    empty

    no

    setMatchesExclude

    String[]

    Specify the regular expressions that must be match the request URL to not measure the request.

    empty

    no

    addMatchesExclude

    String

    Specify the regular expression that must be match the request URL to not measure the request.

    empty

    no

    setLogger

    MappIntelligenceLogger

    Activates the debug mode. The debug mode sends messages your own LoggerClass (see MappIntelligenceLogger).

    null

    no

    setLogLevel

    String

    Specify the debug log level:

    • NONE: no logs

    • FATAL: fatal errors

    • ERROR: errors leading to data loss or break code

    • WARN: errors that can affect data quality

    • INFO:  general info on configuration and send status

    • DEBUG: general info on request sendout and queue status

    ERROR

    no

    setDebug

    Boolean

    Activates the debug mode. The debug mode sends messages to the PHP system logger (Operating System's system logging mechanism or a file, depending on what the error_log configuration directive is set to).

    false

    no

    setDeactivate

    Boolean

    Deactivate the tracking functionality.

    false

    no

    setConsumerType

    String

    Specify the consumer to use for data transfer to Intelligence ( CURL, FORK_CURL, FILE, FILE_ROTATION or CUSTOM).

    CURL

    no

    setConsumer

    MappIntelligenceConsumer

    Specify the custom consumer for data transfer to Intelligence (see MappIntelligenceConsumer).

    null

    no

    setFilename

    String

    Enter the path to your request logging file. This is only relevant when using FILE consumer.

    sys_get_temp_dir() . '/MappIntelligence


    Requests.log'

    no

    setFilePath

    String

    Enter the path to your request logging file. This is only relevant when using FILE_ROTATION consumer.

    sys_get_temp_dir() . '/'

    no

    setFilePrefix

    String

    Enter the prefix from your request logging files. This is only relevant when using FILE_ROTATION consumer.

    MappIntelligenceRequests

    no

    setMaxAttempt

    Integer

    Specify the number of resend attempts. After the maxAttempts have been reached, the requests will be deleted even if the sending failed.

    1

    no

    setAttemptTimeout

    Integer

    Specify the interval of request resend in milliseconds.

    100

    no

    setMaxBatchSize

    Integer

    Specify the maximum request number per batch.

    50

    no

    setMaxQueueSize

    Integer

    Specify the maximum number of requests saved in the queue.

    1000

    no

    setMaxFileLines

    Integer

    The maximum number of lines per file.

    10 * 1000

    no

    setMaxFileDuration

    Integer

    The maximum file duration.

    30 * 60 * 1000

    no

    setMaxFileSize

    Integer

    The maximum number of maximal file size.

    24 * 1024 * 1024

    no

    setForceSSL

    Boolean

    Sends every request via SSL.

    true

    no

    setUserAgent

    String

    Enter the origin client HTTP user agent string.

    $_SERVER['HTTP_USER_AGENT']

    no

    setClientHintUserAgent

    String

    Enter the origin Client Hint header for "sec-ch-ua" (see  How can I make my website ready for Google Chrome's Client Hints? and  Information on Google Chrome User-Agent Client Hints for more details).

    empty

    no

    setClientHintUserAgentFullVersionList

    String

    Enter the origin Client Hint header for "sec-ch-ua-full-version-list" (see  How can I make my website ready for Google Chrome's Client Hints? and  Information on Google Chrome User-Agent Client Hints for more details).

    empty

    no

    setClientHintUserAgentMobile

    String

    Enter the origin Client Hint header for "sec-ch-ua-mobile" (see  How can I make my website ready for Google Chrome's Client Hints? and  Information on Google Chrome User-Agent Client Hints for more details).

    empty

    no

    setClientHintUserAgentModel

    String

    Enter the origin Client Hint header for "sec-ch-ua-model" (see  How can I make my website ready for Google Chrome's Client Hints? and  Information on Google Chrome User-Agent Client Hints for more details).

    empty

    no

    setClientHintUserAgentPlatform

    String

    Enter the origin Client Hint header for "sec-ch-ua-platform" (see  How can I make my website ready for Google Chrome's Client Hints? and  Information on Google Chrome User-Agent Client Hints for more details).

    empty

    no

    setClientHintUserAgentPlatformVersion

    String

    Enter the origin Client Hint header for "sec-ch-ua-platform-version" (see  How can I make my website ready for Google Chrome's Client Hints? and  Information on Google Chrome User-Agent Client Hints for more details).

    empty

    no

    setRemoteAddress

    String

    Enter the origin client Remote address (ip).

    $_SERVER['REMOTE_ADDR']

    no

    setReferrerURL

    String

    Enter the origin client HTTP referrer URL.

    $_SERVER['HTTP_REFERER']

    no

    setRequestURL

    String

    Enter the origin client HTTP request URL.

    "https://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']

    no

    setCookie

    String[]

    Enter a array of all origin client cookies.

    $_COOKIE

    no

    addCookie

    String

    Enter a origin client cookie (key, value).

    empty

    no

    $mappIntelligenceConfig = new MappIntelligenceConfig(
    	"path/to/your/config/file/config.ini"
    );
    [tracking]
    trackId="111111111111111"
    trackDomain="analytics01.wt-eu02.net"
    deactivate=false
    domain[]="sub.domain.tld"
    useParamsForDefaultPageName[]="aa"
    useParamsForDefaultPageName[]="bb"
    useParamsForDefaultPageName[]="cc"
    containsInclude[]=foo
    containsInclude[]=bar
    containsExclude[]=test
    matchesInclude[]=/.*foo.*/
    matchesInclude[]=/.*bar.*/
    matchesExclude[]=/.*test.*/
    
    [debugging]
    debug=false
    logLevel=DEBUG
    
    [consumer]
    consumerType="FILE_ROTATION"
    filePath=""
    filePrefix=""
    maxAttempt=1
    attemptTimeout=100
    maxBatchSize=50
    maxQueueSize=1000
    maxFileLines=10000
    maxFileDuration=1800000
    maxFileSize=25165824
    forceSSL=true


    Was this article helpful?

    What's Next