Log In  |  Sign Up  |  Help

Reporting - present stats

Overview

Using the DudaMobile API, you can pull analytics for a specific mobile website. You can then display them for your users or send them an email containing the information.

Target Audience:

Anyone looking to be able to pull site analytics out of Duda and into their own system.

Available for: Anyone.

Essentials before getting started:

  1. Requested API access and have been approved. Have your API user and password keys ready.

Steps to Implement the use case:

Download Full implementation code: StatsAPI.php.zip

1) Get Site Analytics API

In order to get Analytics for a site

API URL: https://api.dudamobile.com/api/analytics/site/{site_name}

URL Parameters: site_alias - your site alias (mandatory)

Parameters:

from - Start date (optional)

to - End date (optional)

result - either: "traffic" or "activities", default is "traffic" (optional)

Success response code: [http_code] => 200


PHP Code example: (replace {parameter} with actual value)

	<?php
$data = '';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.dudamobile.com/api/analytics/site/{site_alias}');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "{your_api_username}:{your_api_password}");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(                                                                          
	'Content-Type: application/json', 		
	'Content-Length: ' . strlen($data))                                                                       
);   
$output = curl_exec($ch);
curl_close($ch);
print_r($output);
?>

If the result parameter is "traffic", the output print will include the following parameters: visits, unique_visitors, page_view.

If the result parameter is “activities”, the output print will include the following parameters: click_to_calls, click_to_maps, click_to_emails.