client-analytics.d.ts 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. import { ClientTransporterOptions } from '@algolia/client-common';
  2. import { CreateClient } from '@algolia/client-common';
  3. import { RequestOptions } from '@algolia/transporter';
  4. import { SearchOptions } from '@algolia/client-search';
  5. import { Transporter } from '@algolia/transporter';
  6. export declare type ABTest = {
  7. /**
  8. * The ab test name.
  9. */
  10. readonly name: string;
  11. /**
  12. * The ab test list of variants.
  13. */
  14. readonly variants: readonly Variant[];
  15. /**
  16. * The ab test end date, if any.
  17. */
  18. readonly endAt: string;
  19. };
  20. export declare const addABTest: (base: AnalyticsClient) => (abTest: ABTest, requestOptions?: RequestOptions | undefined) => Readonly<Promise<AddABTestResponse>>;
  21. export declare type AddABTestResponse = {
  22. /**
  23. * The ab test unique identifier.
  24. */
  25. abTestID: number;
  26. /**
  27. * The operation task id. May be used to perform a wait task.
  28. */
  29. taskID: number;
  30. /**
  31. * The index name where the ab test is attached to.
  32. */
  33. index: string;
  34. };
  35. export declare type AnalyticsClient = {
  36. /**
  37. * The application id.
  38. */
  39. readonly appId: string;
  40. /**
  41. * The underlying transporter.
  42. */
  43. readonly transporter: Transporter;
  44. };
  45. export declare type AnalyticsClientOptions = {
  46. /**
  47. * The application id.
  48. */
  49. readonly appId: string;
  50. /**
  51. * The api key.
  52. */
  53. readonly apiKey: string;
  54. /**
  55. * The prefered region.
  56. */
  57. readonly region?: 'de' | 'us';
  58. };
  59. export declare const createAnalyticsClient: CreateClient<AnalyticsClient, AnalyticsClientOptions & ClientTransporterOptions>;
  60. export declare const deleteABTest: (base: AnalyticsClient) => (abTestID: number, requestOptions?: RequestOptions | undefined) => Readonly<Promise<DeleteABTestResponse>>;
  61. export declare type DeleteABTestResponse = {
  62. /**
  63. * The ab test unique identifier.
  64. */
  65. abTestID: number;
  66. /**
  67. * The operation task id. May be used to perform a wait task.
  68. */
  69. taskID: number;
  70. /**
  71. * The index name where the ab test was attached to.
  72. */
  73. index: string;
  74. };
  75. export declare const getABTest: (base: AnalyticsClient) => (abTestID: number, requestOptions?: RequestOptions | undefined) => Readonly<Promise<GetABTestResponse>>;
  76. export declare type GetABTestResponse = {
  77. /**
  78. * The ab test name.
  79. */
  80. name: string;
  81. /**
  82. * The ab test status.
  83. */
  84. status: string;
  85. /**
  86. * The ab test list of variants.
  87. */
  88. variants: VariantResponse[];
  89. /**
  90. * The ab test end date, if any.
  91. */
  92. endAt: string;
  93. /**
  94. * The ab test created date, if any.
  95. */
  96. createdAt: string;
  97. /**
  98. * The ab test updated date.
  99. */
  100. updatedAt: string;
  101. /**
  102. * The ab test unique identifier.
  103. */
  104. abTestID: number;
  105. /**
  106. * The ab test significance based on click data. Should be higher than 0.95 to be considered significant - no matter which variant is winning.
  107. */
  108. clickSignificance: number;
  109. /**
  110. *
  111. * The ab test significance based on conversion data. Should be higher than 0.95 to be considered significant - no matter which variant is winning.
  112. */
  113. conversionSignificance: number;
  114. };
  115. export declare const getABTests: (base: AnalyticsClient) => (requestOptions?: (RequestOptions & GetABTestsOptions) | undefined) => Readonly<Promise<GetABTestsResponse>>;
  116. export declare type GetABTestsOptions = {
  117. /**
  118. * The number of ab tests to skip from the biginning of the list.
  119. */
  120. readonly offset?: number;
  121. /**
  122. * The limit of the number of ab tests returned.
  123. */
  124. readonly limit?: number;
  125. };
  126. export declare type GetABTestsResponse = {
  127. /**
  128. * The number of ab tests within this response.
  129. */
  130. count: number;
  131. /**
  132. * The total of ab tests.
  133. */
  134. total: number;
  135. /**
  136. * The list of ab tests.
  137. */
  138. abtests: GetABTestResponse[] | null;
  139. };
  140. export declare const stopABTest: (base: AnalyticsClient) => (abTestID: number, requestOptions?: RequestOptions | undefined) => Readonly<Promise<StopABTestResponse>>;
  141. export declare type StopABTestResponse = {
  142. /**
  143. * The ab test unique identifier.
  144. */
  145. abTestID: number;
  146. /**
  147. * The operation task id. May be used to perform a wait task.
  148. */
  149. taskID: number;
  150. /**
  151. * The index name where the ab test is attached to.
  152. */
  153. index: string;
  154. };
  155. export declare type Variant = {
  156. /**
  157. * The index name.
  158. */
  159. readonly index: string;
  160. /**
  161. * Description of the variant. Useful when seing the results in the dashboard or via the API.
  162. */
  163. readonly description?: string;
  164. /**
  165. * Percentage of the traffic that should be going to the variant. The sum of the percentage should be equal to 100.
  166. */
  167. readonly trafficPercentage: number;
  168. /**
  169. * The search parameters.
  170. */
  171. readonly customSearchParameters?: SearchOptions;
  172. };
  173. export declare type VariantResponse = Variant & {
  174. /**
  175. * Average click position for the variant.
  176. */
  177. averageClickPosition?: number;
  178. /**
  179. * Distinct click count for the variant.
  180. */
  181. clickCount?: number;
  182. /**
  183. * Click through rate for the variant.
  184. */
  185. clickThroughRate?: number;
  186. /**
  187. * Click through rate for the variant.
  188. */
  189. conversionCount?: number;
  190. /**
  191. * Distinct conversion count for the variant.
  192. */
  193. conversionRate?: number;
  194. /**
  195. * No result count.
  196. */
  197. noResultCount?: number;
  198. /**
  199. * Tracked search count.
  200. */
  201. trackedSearchCount?: number;
  202. /**
  203. * Search count.
  204. */
  205. searchCount?: number;
  206. /**
  207. * User count.
  208. */
  209. userCount?: number;
  210. /**
  211. * The search parameters.
  212. */
  213. customSearchParameters?: SearchOptions;
  214. };
  215. export { }