- 3 Minutes to read
- Print
- DarkLight
PHP Library
- 3 Minutes to read
- Print
- DarkLight
Server-side tracking is crucial for companies that must measure mission-critical information on their website, such as order information or other website goals. The PHP library of Mapp Intelligence helps you to set up server-side tracking when using Mapp Intelligence as your analysis tool.
Basic Information
The mapp-digital/mapp-intelligence-tracking is a PHP client for Mapp Intelligence. The basis for the data collection on your server is implementing the respective library. The Mapp Intelligence tracking library provides scripts to track user behavior and technical information, such as user agents, among others. In addition to the standard data collection, the tracking library offers many options to customize tracking based on specific use cases. Typical use cases are product, order, and shipment tracking or the tracking of application processes.
Use Cases: Server-Side Tracking
There are four main use cases for the Mapp Intelligence PHP server library.
Pure Server-Side Tracking
This solution requires the use of the PHP library as the only source of data collection. Note that this solution prevents any client-side actions from being tracked; such as action, form, or media requests. Customers with high data protection and security requirements benefit from pure server-side tracking. The tracking script is saved on your own servers and sends to the track server from there.
Key Features of Server-Side Tracking
All consumer methods are supported and can be used based on the specific requirements.
You need to pass a unique identification of each user to the library to receive correct analyses in the dashboards. This can either be done via the setUserId() function or by creating a unique ID yourself.
All track requests are sent to the track server, the library does not rely on browser and cookie permissions.
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, Google Chrome) preload a website in the background when appearing in search results. Since this will create a call on the server, a page impression will be created, which might lead to increased page impressions and bounce rates (if the user did not visit the website after all), and decreased page and visit duration time.
Caching of pages: If you are caching the websites in the browser to increase performance, a page impression might not be tracked if the cache in the browser prevents a call to the server. This might decrease overall page impressions and affect previous and follower pages in the path analysis.
Configuration recommendation
$mappIntelligenceConfig = new MappIntelligenceConfig();
$mappIntelligenceConfig->setTrackDomain("analytics01.wt-eu02.net")
->setTrackId("111111111111111")
->setConsumerType(MappIntelligenceConsumerType::FILE_ROTATION)
->setForceSSL(true);
$mappIntelligence = MappIntelligence::getInstance($mappIntelligenceConfig);
Hybrid Tracking: Server Lib and Pixel
You can benefit from the best of the two worlds by using both the pixel and server library. With this setup you could track all actions, forms, or media via the pixel, but page-related information is tracked using the PHP library.
Key Features of Hybrid Tracking
Both the pixel and the PHP library are used to collect data.
Customers do not need to set up a custom track domain as the requests are sent to the customer's servers.
To ensure the correct processing of the data, customers must send the pixel requests to the server library and use the file or file rotation consumer to send tracking data to the track server.
Customers must send the pixel requests to their own server, and use the file consumer to send the requests, alongside the server-side created requests, to the track server.
Configuration recommendation
$mappIntelligenceConfig = new MappIntelligenceConfig();
$mappIntelligenceConfig->setTrackDomain("analytics01.wt-eu02.net")
->setTrackId("111111111111111")
->setConsumerType(MappIntelligenceConsumerType::FILE_ROTATION)
->setForceSSL(true);
$mappIntelligence = MappIntelligence::getInstance($mappIntelligenceConfig);
Server-Side Tracking for Mission-Critical Information
It is also possible to use the server-side library to collect data that is critical for the company's success, but use the pixel for less critical information. Critical information can include order and shipping information or application confirmation.
Key Features of Server-Side Tracking for Mission-Critical Information
The pixel can send the requests directly to the track server and not to the customer's server.
The customer's server does not need to handle as much load as it does in the other use cases mentioned above.
http client consumer must be used on the server-side library.
The server-side library needs to send incoming requests immediately to the track server to ensure the processing of the tracking data in Intelligence is correct.
Configuration recommendation
$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);
Server-Side Library as Track domain
It is possible to track all requests via the pixel, but use the server-side library to collect and send the data to the Mapp Intelligence track server. This option allows the pixel to make full use of browser-side tracking and cookies. Then, instead of exploiting the track domain address to the browser, the requests are sent from the server to Mapp Intelligence.
Recommendation
Use the MappIntelligenceHybrid with Cronjob logic for this use case