This article describes the configuration and technical integration needed for the Realtime Data Feed Service.

With the Realtime Data Feed Service, you can retrieve data from Mapp Intelligence in real time. You can customize your website based on tracking data depending on specific users. Based on the data, ads can be dynamically selected, or search results and recommendations can be adapted to each user’s surfing behavior. For example, you can integrate applications into your ad offering to show, in real-time,

  • the day’s top 10 products,
  • the most-read articles,
  • the most-bought articles for men

as dynamic lists. Use the service to retrieve content from your website that perfectly matches your user groups and improves their experience of using it.


Prerequisites for the successful integration are:

  • an existing Mapp account
  • an existing Mapp integration
  • Realtime Data Feed Service enabled
  • Data feeds saved in the tool

The integration process includes the following points:

  • possible release of features (by getting in touch with your contact)
  • feed set-up (analyses) in Mapp
  • integration of feed queries in your website.

Creating a feed in Mapp Q3

Real-time data queries are only possible if the relevant feed has been set up in Mapp.

Go to Mapp Q3 > Configuration > Feeds for an overview of data feeds already created. You can always view and edit their statuses and configurations there.

Please get in touch with your key account contact or technical support at support@webtrekk.com to have the Realtime Data Feed Service enabled.


Creating a data feed

Data feeds have to be created manually. This is done in Mapp Q3 > Configuration > Feeds >New feed. Because data feeds can be used in different ways, those for the real-time service must be labeled accordingly:

  • Type of feed: Export
  • Export destination: Realtime Data Feed Service

You can customize your feed under “Type of data”, “Exported data”, “Time period” and “Line limit”. The feed is then saved. When configuring a feed, please note the following.

  • If you choose one of the periods "Yesterday", "Last 7 days", "Last week", "Last 14 days", or "Last 28 days" it is not sensible to set "Actualization" (in the case of "Daily") to "00:00" o clock because in that case, the feed will in general not contain all data of the chosen period. "Actualization" determines when the feed is populated and at 0:00 may not include the most recent data. Setting the "Actualization" to "06:00" or later is recommended to ensure that all data of the chosen period is included in the feed.
  • If you choose one of the periods "Last 10 minutes", "Last 20 minutes", "Last 30 minutes", "Last 60 minutes", "Last 60 minutes, to the minute", "Last full hour", "Last full 6 hours", or "Current hour" then "Actualization" should be carefully set. For example, it is not sensible to set "Actualization" to "Daily" if the period is set to "Last 10 minutes".

Integration and use

To query the tracking data with the Realtime Data Feed Service, you must make an HTTP-GET request to the Mapp server. The Realtime Data Feed Service returns a JSON object in reply.

Using the plugin

Mapp offers a ready plugin to retrieve data directly from the Realtime Data Feed Service to simplify use. The “WebtrekkRDFSClient” function initializes the plugin and returns the “getFeedData” function to send queries to the Realtime Data Feed Service. To use the “WebtrekkRDFSClient” function, integrate the “Webtrekk_rdfs.js” file into your page.
All queries are started automatically and asynchronously in the background and, as a result, do not slow up the page display.

/**
* @param {String} trackId Mapp Track-ID
* @param {Integer} max. timeout in milliseconds [optional]
* @param {String} feedURL Base URL for querying the Realtime Data Feed Service [optional]
* @ a function to query the data is returned
*/
WebtrekkRDFSClient(trackId, timeout, feedURL)
Example of a feed URL:
http://feeds.webtrekk.com/api/385255285199574/feeds/24862ae
CODE
/**
* @param {Function} callback function subsequently executed
* @param {String} feedId Feed ID
* @param {Array} segments segments to filter by [optional]
*/
getFeedData(callback, feedId, segments)
CODE


Standard query – segment unspecified

Example of a complete query without segments:
<script type=”text/javascript”>
<!--
	var wt_rdsfConfig = {
		trackId : "385255285199574",
		feedId : "83142aac0858927fd70757282dab0003",
		timeout : 3000
	};
	function alertFeed(json) {
		if(json.length > 0) {
			alert(json.join("; "));
		}
	};
	var wt_rdfsTest = WbtrekkRDFSClient(wt_rdsfConfig.userId, wt_rdsfConfig.timeout);
	wt_rdfsTest.getFeedData(alertFeed, wt_rdsfConfig.feedId);
//-->
</script>
CODE

In the above example, the RDFS client with User ID “385255285199574” and a timeout of 3000 milliseconds is initialized. The data is then polled for the feed with the ID “83142aac0858927fd70757282dab0003”. Once the data is reloaded the callback function “alertFeed” is called and the data output as an array. The callback function returns an empty array if no reload is possible within the timeout.

Nested queries – segment specified

Example of a complete query with segments:
<script type=”text/javascript”>
<!--
	var wt_rdsfConfig = {
		trackId : "385255285199574",
		contentFeedId : "83142aac0858927fd70757282dab0003",
		linkFeedId : "24862ae69416de10d0de9cce1f5a50f9",
		timeout : 3000
	};
	function alertContent(json) {
		if(json.length > 0) {
			alert(json.join("; "));
			for(var i = 0; i < json.length; i++) {
				wt_rdfsTest.getFeedData(alertLink, wt_rdsfConfig.linkFeedId, [json[i]]);
			}
		}
	};
	function alertLink(json) {
		if(json.length > 0) {
			alert(json.join("; "));
		}
	};
	var wt_rdfsTest = WebtrekkRDFSClient(wt_rdsfConfig.trackId, wt_rdsfConfig.timeout);
	wt_rdfsTest.getFeedData(alertContent, wt_rdsfConfig.contentFeedId);
//-->
</script>
CODE

In the above example, the RDFS client with User ID “385255285199574” and a timeout of 3000 milliseconds is initialized.

The data is then polled for the feed with the ID “83142aac0858927fd70757282dab0003”.

Once the data is reloaded the callback function “alertContent” is called and the data output as an array.

If the passed array contains elements, each Content ID triggers a query to another feed with ID “24862ae69416de10d0de9cce1f5a50f9”. Here, the Content ID acts as a segment passed as an array.

Once the data is reloaded the callback function “alertLink” is called and the data output as an array. The callback function returns an empty array if no reload is possible within the timeout.