We recommend using a cron job to send the logfile requests to the Mapp tracking server every few minutes and empty your file to keep it at a manageable size. You have two possibilities:

Custom Cron Job File

This option requires you to write your own cron job file and use our MappIntelligenceCronjob class.

Integration

Maven

<dependency>
    <groupId>com.mapp.intelligence.tracking</groupId>
    <artifactId>cronjob</artifactId>
    <version>0.0.1</version>
</dependency>
XML

Gradle

compile group: 'com.mapp.intelligence.tracking', name: 'cronjob', version: '0.0.1'
BASH

Methods

constructor

For a complete configuration of the Mapp Intelligence Cronjob please check Configuration.

/**
 * @param config Mapp Intelligence config
 * @throws MappIntelligenceException Mapp Intelligence configuration exception
 */
MappIntelligenceCronjob cronjob = new MappIntelligenceCronjob(MappIntelligenceConfig config);
JAVA

run

Send the logfile requests to the Mapp tracking server and delete your logfiles to keep it at a mangeable size. Returns the following results:

  • 0: All data was sent successfully.
  • 1: An error has occurred.
/**
 * @return Status
 */
cronjob.run();
PHP
Example
package demo.cronjob;

import com.mapp.intelligence.tracking.MappIntelligenceConfig;
import com.mapp.intelligence.tracking.MappIntelligenceCronjob;

public class MappIntelligenceCronjobCommandLine {
	public static void main(String[] args) {
        int status = 1;
        try {
			MappIntelligenceConfig mappIntelligenceConfig = new MappIntelligenceConfig();
			mappIntelligenceConfig.setTrackId("111111111111111");
			mappIntelligenceConfig.setTrackDomain("analytics01.wt-eu02.net");
			mappIntelligenceConfig.setFilePath("/path/to/your/log/file/");
			mappIntelligenceConfig.setFilePrefix("MappIntelligenceData");
			
            MappIntelligenceCronjob c = new MappIntelligenceCronjob(mappIntelligenceConfig);
            status = c.run();
        } catch (Exception e) {
            // do nothing
        }

        System.exit(status);
    }
}
JAVA

Predefined Cron Job Script

This option allows you to use our predefined mapp-intelligence-java-cronjob.jar file, which is included in our repository

Short notationLong notationDescription
-i--trackIdEnter your Mapp Intelligence track ID provided by Mapp.
-d--trackDomainEnter your Mapp Intelligence tracking URL.
-f--filePathEnter the path to your request logging file.
-p--filePrefixEnter the prefix for your request logging files.

-c--configEnter the path to your configuration file (*.properties or *.xml).


--debugActivates the debug mode. The debug mode sends messages to the command line.

--helpDisplay the help (this text) and exit.

--versionDisplay version and exit.
Example
$ java -jar ./mapp-intelligence-java-cronjob.jar -i 111111111111111 -d analytics01.wt-eu02.net -f /tmp/ -p MappIntelligenceData
 
$ java -jar ./mapp-intelligence-java-cronjob.jar -i 111111111111111 -d analytics01.wt-eu02.net -f /tmp/ -p MappIntelligenceData --debug
 
 
$ java -jar ./mapp-intelligence-java-cronjob.jar -c /path/to/your/configuration/file/config.properties
 
$ java -jar ./mapp-intelligence-java-cronjob.jar -c /path/to/your/configuration/file/config.properties --debug
PHP

Define a Cron Job

To create your crontab file, type the following command at the shell prompt crontab -e and add the following lines:

# sends every five minutes the tracking data to the Mapp tracking serve
*/5 * * * * java -jar ./mapp-intelligence-java-cronjob.jar -c /path/to/your/configuration/file/config.properties
PHP