PHP Library

Prev Next

The Mapp Intelligence PHP Library provides a server-side integration for sending tracking data directly from your backend to Mapp Intelligence. It enables full or partial server-side tracking — for example, to record orders, confirmations, or other events without relying on client-side scripts.

Before using the PHP Library, make sure you have read the Server-to-Server Basics section. That page explains the general tracking structure, request format, parameters, and session handling logic that apply to all server-to-server integrations.


Overview

Aspect

Description

Library name

mapp-digital/mapp-intelligence-tracking

Purpose

Server-side data collection for Mapp Intelligence

Use cases

Product, order, shipment, and application tracking

Integration

Composer (see Integration & Configuration)


Key Concepts

The PHP library can be used in different tracking setups depending on your data protection requirements and system architecture. Each approach determines how data is collected and forwarded to Mapp Intelligence.


1. Pure Server-Side Tracking

All tracking requests are created and sent from your server using the PHP library. This approach does not rely on any client-side scripts or cookies and is ideal for environments with strict data protection or limited browser access.

Key Features:

  • All consumer types are supported (FILE, FILE_ROTATION, CURL, or custom).

  • A unique user identifier (everID) must be passed manually (via setUserId() or a custom ID).

  • Tracking data is sent directly to the track server without browser dependencies.

  • Depending on browser and caching behavior, this approach may slightly affect page impression counts.

Tracking Considerations

Pure server-side tracking or the use of the server-side library to track all page requests might affect the number of page impressions if one of the following conditions is true:

  • Preloading of pages in search results

    Some browsers (for example, Safari or Google Chrome) preload websites in the background when they appear in search results. Since this generates a server call, a page impression may be counted even if the user never opened the page. This can lead to increased page impressions, higher bounce rates, and shorter visit durations.

  • Caching of pages

    If pages are cached in the browser to improve performance, a page impression may not be tracked if the cache prevents a new server call. This can slightly reduce the total number of tracked page impressions and may affect path analyses for previous and following pages.

Configuration Example

$mappIntelligenceConfig = new MappIntelligenceConfig();
$mappIntelligenceConfig->setTrackDomain("analytics01.wt-eu02.net")
    ->setTrackId("111111111111111")
    ->setConsumerType(MappIntelligenceConsumerType::FILE_ROTATION)
    ->setForceSSL(true);

$mappIntelligence = MappIntelligence::getInstance($mappIntelligenceConfig);

2. Hybrid Tracking (Pixel + PHP Library)

Combining the PHP library with the Mapp tracking pixel allows you to use both client- and server-side data sources.

This setup provides maximum flexibility — for example, tracking user interactions via the pixel while recording page-related data via the server.

Key Features:

  • Data is collected by both the tracking pixel and the PHP library.

  • No custom track domain is required.

  • Pixel requests are forwarded to the server library, which sends them via the FILE or FILE_ROTATION consumer to the track server.

Configuration Example

$mappIntelligenceConfig = new MappIntelligenceConfig();
$mappIntelligenceConfig->setTrackDomain("analytics01.wt-eu02.net")
    ->setTrackId("111111111111111")
    ->setConsumerType(MappIntelligenceConsumerType::FILE_ROTATION)
    ->setForceSSL(true);

$mappIntelligence = MappIntelligence::getInstance($mappIntelligenceConfig);

3. Tracking Mission-Critical Information

Use the PHP library exclusively for mission-critical data (for example, orders, confirmations, or shipping events), while the tracking pixel continues to collect less sensitive data.

Key Features:

  • Reduces load on the customer’s server.

  • The pixel sends regular browser data directly to the track server.

  • The PHP library uses the CURL consumer to send critical data immediately.

Configuration Example

$mappIntelligenceConfig = new MappIntelligenceConfig();
$mappIntelligenceConfig->setTrackDomain("analytics01.wt-eu02.net")
    ->setTrackId("111111111111111")
    ->setConsumerType(MappIntelligenceConsumerType::CURL)
    ->setMaxAttempt(3)
    ->setAttemptTimeout(100)
    ->setMaxBatchSize(1)
    ->setForceSSL(true);

$mappIntelligence = MappIntelligence::getInstance($mappIntelligenceConfig);

4. Server Library as Track Domain

All requests are collected through the tracking pixel but routed via your server to Mapp Intelligence.

This approach hides the Mapp track domain from the browser and allows full client-side functionality while retaining server control.

Recommendation

Use the MappIntelligenceHybrid with Cronjob logic for this use case.