1: <?php
2:
3: class Mandrill_Urls {
4: public function __construct(Mandrill $master) {
5: $this->master = $master;
6: }
7:
8: /**
9: * Get the 100 most clicked URLs
10: * @return array the 100 most clicked URLs and their stats
11: * - return[] struct the individual URL stats
12: * - url string the URL to be tracked
13: * - sent integer the number of emails that contained the URL
14: * - clicks integer the number of times the URL has been clicked from a tracked email
15: * - unique_clicks integer the number of unique emails that have generated clicks for this URL
16: */
17: public function getList() {
18: $_params = array();
19: return $this->master->call('urls/list', $_params);
20: }
21:
22: /**
23: * Return the 100 most clicked URLs that match the search query given
24: * @param string $q a search query
25: * @return array the 100 most clicked URLs matching the search query
26: * - return[] struct the URL matching the query
27: * - url string the URL to be tracked
28: * - sent integer the number of emails that contained the URL
29: * - clicks integer the number of times the URL has been clicked from a tracked email
30: * - unique_clicks integer the number of unique emails that have generated clicks for this URL
31: */
32: public function search($q) {
33: $_params = array("q" => $q);
34: return $this->master->call('urls/search', $_params);
35: }
36:
37: /**
38: * Return the recent history (hourly stats for the last 30 days) for a url
39: * @param string $url an existing URL
40: * @return array the array of history information
41: * - return[] struct the information for a single hour
42: * - time string the hour as a UTC date string in YYYY-MM-DD HH:MM:SS format
43: * - sent integer the number of emails that were sent with the URL during the hour
44: * - clicks integer the number of times the URL was clicked during the hour
45: * - unique_clicks integer the number of unique clicks generated for emails sent with this URL during the hour
46: */
47: public function timeSeries($url) {
48: $_params = array("url" => $url);
49: return $this->master->call('urls/time-series', $_params);
50: }
51:
52: }
53:
54:
55: