vendor/mandrill/mandrill/src/Mandrill/Urls.php line 5

Open in your IDE?
  1. <?php
  2. class Mandrill_Urls {
  3. public function __construct(Mandrill $master) {
  4. $this->master = $master;
  5. }
  6. /**
  7. * Get the 100 most clicked URLs
  8. * @return array the 100 most clicked URLs and their stats
  9. * - return[] struct the individual URL stats
  10. * - url string the URL to be tracked
  11. * - sent integer the number of emails that contained the URL
  12. * - clicks integer the number of times the URL has been clicked from a tracked email
  13. * - unique_clicks integer the number of unique emails that have generated clicks for this URL
  14. */
  15. public function getList() {
  16. $_params = array();
  17. return $this->master->call('urls/list', $_params);
  18. }
  19. /**
  20. * Return the 100 most clicked URLs that match the search query given
  21. * @param string $q a search query
  22. * @return array the 100 most clicked URLs matching the search query
  23. * - return[] struct the URL matching the query
  24. * - url string the URL to be tracked
  25. * - sent integer the number of emails that contained the URL
  26. * - clicks integer the number of times the URL has been clicked from a tracked email
  27. * - unique_clicks integer the number of unique emails that have generated clicks for this URL
  28. */
  29. public function search($q) {
  30. $_params = array("q" => $q);
  31. return $this->master->call('urls/search', $_params);
  32. }
  33. /**
  34. * Return the recent history (hourly stats for the last 30 days) for a url
  35. * @param string $url an existing URL
  36. * @return array the array of history information
  37. * - return[] struct the information for a single hour
  38. * - time string the hour as a UTC date string in YYYY-MM-DD HH:MM:SS format
  39. * - sent integer the number of emails that were sent with the URL during the hour
  40. * - clicks integer the number of times the URL was clicked during the hour
  41. * - unique_clicks integer the number of unique clicks generated for emails sent with this URL during the hour
  42. */
  43. public function timeSeries($url) {
  44. $_params = array("url" => $url);
  45. return $this->master->call('urls/time-series', $_params);
  46. }
  47. /**
  48. * Get the list of tracking domains set up for this account
  49. * @return array the tracking domains and their status
  50. * - return[] struct the individual tracking domain
  51. * - domain string the tracking domain name
  52. * - created_at string the date and time that the tracking domain was added as a UTC string in YYYY-MM-DD HH:MM:SS format
  53. * - last_tested_at string when the domain's DNS settings were last tested as a UTC string in YYYY-MM-DD HH:MM:SS format
  54. * - cname struct details about the domain's CNAME record
  55. * - valid boolean whether the domain's CNAME record is valid for use with Mandrill
  56. * - valid_after string when the domain's CNAME record will be considered valid for use with Mandrill as a UTC string in YYYY-MM-DD HH:MM:SS format. If set, this indicates that the record is valid now, but was previously invalid, and Mandrill will wait until the record's TTL elapses to start using it.
  57. * - error string an error describing the CNAME record, or null if the record is correct
  58. * - valid_tracking boolean whether this domain can be used as a tracking domain for email.
  59. */
  60. public function trackingDomains() {
  61. $_params = array();
  62. return $this->master->call('urls/tracking-domains', $_params);
  63. }
  64. /**
  65. * Add a tracking domain to your account
  66. * @param string $domain a domain name
  67. * @return struct information about the domain
  68. * - domain string the tracking domain name
  69. * - created_at string the date and time that the tracking domain was added as a UTC string in YYYY-MM-DD HH:MM:SS format
  70. * - last_tested_at string when the domain's DNS settings were last tested as a UTC string in YYYY-MM-DD HH:MM:SS format
  71. * - cname struct details about the domain's CNAME record
  72. * - valid boolean whether the domain's CNAME record is valid for use with Mandrill
  73. * - valid_after string when the domain's CNAME record will be considered valid for use with Mandrill as a UTC string in YYYY-MM-DD HH:MM:SS format. If set, this indicates that the record is valid now, but was previously invalid, and Mandrill will wait until the record's TTL elapses to start using it.
  74. * - error string an error describing the CNAME record, or null if the record is correct
  75. * - valid_tracking boolean whether this domain can be used as a tracking domain for email.
  76. */
  77. public function addTrackingDomain($domain) {
  78. $_params = array("domain" => $domain);
  79. return $this->master->call('urls/add-tracking-domain', $_params);
  80. }
  81. /**
  82. * Checks the CNAME settings for a tracking domain. The domain must have been added already with the add-tracking-domain call
  83. * @param string $domain an existing tracking domain name
  84. * @return struct information about the tracking domain
  85. * - domain string the tracking domain name
  86. * - created_at string the date and time that the tracking domain was added as a UTC string in YYYY-MM-DD HH:MM:SS format
  87. * - last_tested_at string when the domain's DNS settings were last tested as a UTC string in YYYY-MM-DD HH:MM:SS format
  88. * - cname struct details about the domain's CNAME record
  89. * - valid boolean whether the domain's CNAME record is valid for use with Mandrill
  90. * - valid_after string when the domain's CNAME record will be considered valid for use with Mandrill as a UTC string in YYYY-MM-DD HH:MM:SS format. If set, this indicates that the record is valid now, but was previously invalid, and Mandrill will wait until the record's TTL elapses to start using it.
  91. * - error string an error describing the CNAME record, or null if the record is correct
  92. * - valid_tracking boolean whether this domain can be used as a tracking domain for email.
  93. */
  94. public function checkTrackingDomain($domain) {
  95. $_params = array("domain" => $domain);
  96. return $this->master->call('urls/check-tracking-domain', $_params);
  97. }
  98. }