export type Breakdown = {type?: ('BROWSER' | 'CUSTOM_DATUM' | 'DEVICE_TYPE' | 'NEW_VISITOR' | 'GOAL_REACHED' | 'PAGE_URL' | 'FIRST_REFERRER' | 'ORIGIN_TYPE' | 'OS' | 'PAGE_TITLE' | 'NUMBER_PAGES' | 'LANDING_PAGE_URL' | 'AD_BLOCKER' | 'DAY_OF_WEEK' | 'DAYS_OF_WEEK' | 'VISIT_DURATION' | 'WEATHER_CODE' | 'DAY' | 'TEMPERATURE' | 'NUMBER_VISITS' | 'FIRST_REFERRER_URL' | 'KEY_PAGE' | 'TARGETING_SEGMENT' | 'TIME_SINCE_PREVIOUS_VISIT' | 'COUNTRY' | 'REGION' | 'CITY' | 'LANGUAGE' | 'LANDING_PAGE' | 'REFERRER' | 'LOCALE_LANGUAGE_CODE' | 'PERSONALIZATION_UNEXPOSITION_CAUSE' | 'CROSS_CAMPAIGN' | 'SDK' | 'SDK_VERSION' | 'INTERVAL' | 'CONVERSION_METADATA') | undefined}; export type ConversionMetadataRequest = {goalId?: number | undefined, index?: number | undefined}; export type ConversionMetadataBreakdownIO1 = {type?: ('BROWSER' | 'CUSTOM_DATUM' | 'DEVICE_TYPE' | 'NEW_VISITOR' | 'GOAL_REACHED' | 'PAGE_URL' | 'FIRST_REFERRER' | 'ORIGIN_TYPE' | 'OS' | 'PAGE_TITLE' | 'NUMBER_PAGES' | 'LANDING_PAGE_URL' | 'AD_BLOCKER' | 'DAY_OF_WEEK' | 'DAYS_OF_WEEK' | 'VISIT_DURATION' | 'WEATHER_CODE' | 'DAY' | 'TEMPERATURE' | 'NUMBER_VISITS' | 'FIRST_REFERRER_URL' | 'KEY_PAGE' | 'TARGETING_SEGMENT' | 'TIME_SINCE_PREVIOUS_VISIT' | 'COUNTRY' | 'REGION' | 'CITY' | 'LANGUAGE' | 'LANDING_PAGE' | 'REFERRER' | 'LOCALE_LANGUAGE_CODE' | 'PERSONALIZATION_UNEXPOSITION_CAUSE' | 'CROSS_CAMPAIGN' | 'SDK' | 'SDK_VERSION' | 'INTERVAL' | 'CONVERSION_METADATA') | undefined, metadatas?: Array | undefined}; export type CrossCampaignBreakdownIO1 = {type?: ('BROWSER' | 'CUSTOM_DATUM' | 'DEVICE_TYPE' | 'NEW_VISITOR' | 'GOAL_REACHED' | 'PAGE_URL' | 'FIRST_REFERRER' | 'ORIGIN_TYPE' | 'OS' | 'PAGE_TITLE' | 'NUMBER_PAGES' | 'LANDING_PAGE_URL' | 'AD_BLOCKER' | 'DAY_OF_WEEK' | 'DAYS_OF_WEEK' | 'VISIT_DURATION' | 'WEATHER_CODE' | 'DAY' | 'TEMPERATURE' | 'NUMBER_VISITS' | 'FIRST_REFERRER_URL' | 'KEY_PAGE' | 'TARGETING_SEGMENT' | 'TIME_SINCE_PREVIOUS_VISIT' | 'COUNTRY' | 'REGION' | 'CITY' | 'LANGUAGE' | 'LANDING_PAGE' | 'REFERRER' | 'LOCALE_LANGUAGE_CODE' | 'PERSONALIZATION_UNEXPOSITION_CAUSE' | 'CROSS_CAMPAIGN' | 'SDK' | 'SDK_VERSION' | 'INTERVAL' | 'CONVERSION_METADATA') | undefined, experiments?: Array | undefined, personalizations?: Array | undefined}; export type CustomDatumBreakdownIO = {type?: ('BROWSER' | 'CUSTOM_DATUM' | 'DEVICE_TYPE' | 'NEW_VISITOR' | 'GOAL_REACHED' | 'PAGE_URL' | 'FIRST_REFERRER' | 'ORIGIN_TYPE' | 'OS' | 'PAGE_TITLE' | 'NUMBER_PAGES' | 'LANDING_PAGE_URL' | 'AD_BLOCKER' | 'DAY_OF_WEEK' | 'DAYS_OF_WEEK' | 'VISIT_DURATION' | 'WEATHER_CODE' | 'DAY' | 'TEMPERATURE' | 'NUMBER_VISITS' | 'FIRST_REFERRER_URL' | 'KEY_PAGE' | 'TARGETING_SEGMENT' | 'TIME_SINCE_PREVIOUS_VISIT' | 'COUNTRY' | 'REGION' | 'CITY' | 'LANGUAGE' | 'LANDING_PAGE' | 'REFERRER' | 'LOCALE_LANGUAGE_CODE' | 'PERSONALIZATION_UNEXPOSITION_CAUSE' | 'CROSS_CAMPAIGN' | 'SDK' | 'SDK_VERSION' | 'INTERVAL' | 'CONVERSION_METADATA') | undefined, index: number}; export type IntervalBreakdownIO1 = {type?: ('BROWSER' | 'CUSTOM_DATUM' | 'DEVICE_TYPE' | 'NEW_VISITOR' | 'GOAL_REACHED' | 'PAGE_URL' | 'FIRST_REFERRER' | 'ORIGIN_TYPE' | 'OS' | 'PAGE_TITLE' | 'NUMBER_PAGES' | 'LANDING_PAGE_URL' | 'AD_BLOCKER' | 'DAY_OF_WEEK' | 'DAYS_OF_WEEK' | 'VISIT_DURATION' | 'WEATHER_CODE' | 'DAY' | 'TEMPERATURE' | 'NUMBER_VISITS' | 'FIRST_REFERRER_URL' | 'KEY_PAGE' | 'TARGETING_SEGMENT' | 'TIME_SINCE_PREVIOUS_VISIT' | 'COUNTRY' | 'REGION' | 'CITY' | 'LANGUAGE' | 'LANDING_PAGE' | 'REFERRER' | 'LOCALE_LANGUAGE_CODE' | 'PERSONALIZATION_UNEXPOSITION_CAUSE' | 'CROSS_CAMPAIGN' | 'SDK' | 'SDK_VERSION' | 'INTERVAL' | 'CONVERSION_METADATA') | undefined, interval?: ('HOUR' | 'DAY' | 'WEEK' | 'MONTH' | 'YEAR') | undefined}; export type AdBlockerFilter = {type: string, include?: boolean | undefined}; export type BrowserFilter = {type: string, values: Array<'CHROME' | 'EDGE' | 'FIREFOX' | 'SAFARI' | 'OPERA' | 'OTHERS'>, include?: boolean | undefined}; export type BrowserLanguageFilter = {type: string, values: Array<'AB' | 'AA' | 'AF' | 'AK' | 'SQ' | 'AM' | 'AR' | 'AN' | 'HY' | 'AS' | 'AV' | 'AE' | 'AY' | 'AZ' | 'BM' | 'BA' | 'EU' | 'BE' | 'BN' | 'BH' | 'BI' | 'BS' | 'BR' | 'BG' | 'MY' | 'CA' | 'CH' | 'CE' | 'NY' | 'ZH' | 'CV' | 'KW' | 'CO' | 'CR' | 'HR' | 'CS' | 'DA' | 'DV' | 'NL' | 'DZ' | 'EN' | 'EO' | 'ET' | 'EE' | 'FO' | 'FJ' | 'FI' | 'FR' | 'FF' | 'GL' | 'KA' | 'DE' | 'EL' | 'GN' | 'GU' | 'HT' | 'HA' | 'HE' | 'HZ' | 'HI' | 'HO' | 'HU' | 'IA' | 'ID' | 'IE' | 'GA' | 'IG' | 'IK' | 'IO' | 'IS' | 'IT' | 'IU' | 'JA' | 'JV' | 'KL' | 'KN' | 'KR' | 'KS' | 'KK' | 'KM' | 'KI' | 'RW' | 'KY' | 'KV' | 'KG' | 'KO' | 'KU' | 'KJ' | 'LA' | 'LB' | 'LG' | 'LI' | 'LN' | 'LO' | 'LT' | 'LU' | 'LV' | 'GV' | 'MK' | 'MG' | 'MS' | 'ML' | 'MT' | 'MI' | 'MR' | 'MH' | 'MN' | 'NA' | 'NV' | 'ND' | 'NE' | 'NG' | 'NB' | 'NN' | 'NO' | 'II' | 'NR' | 'OC' | 'OJ' | 'CU' | 'OM' | 'OR' | 'OS' | 'PA' | 'PI' | 'FA' | 'PL' | 'PS' | 'PT' | 'QU' | 'RM' | 'RN' | 'RO' | 'RU' | 'SA' | 'SC' | 'SD' | 'SE' | 'SM' | 'SG' | 'SR' | 'GD' | 'SN' | 'SI' | 'SK' | 'SL' | 'SO' | 'ST' | 'ES' | 'SU' | 'SW' | 'SS' | 'SV' | 'TA' | 'TE' | 'TG' | 'TH' | 'TI' | 'BO' | 'TK' | 'TL' | 'TN' | 'TO' | 'TR' | 'TS' | 'TT' | 'TW' | 'TY' | 'UG' | 'UK' | 'UR' | 'UZ' | 'VE' | 'VI' | 'VO' | 'WA' | 'CY' | 'WO' | 'FY' | 'XH' | 'YI' | 'YO' | 'ZA' | 'ZU'>, include?: boolean | undefined}; export type DeviceTypeFilter = {type: string, values: Array<'DESKTOP' | 'TABLET' | 'PHONE' | 'OTHERS'>, include?: boolean | undefined}; export type NewVisitorFilter = {type: string, visitorsType?: ('NEW_VISITORS' | 'RETURNING_VISITORS') | undefined}; export type OperatingSystemFilter = {type: string, values: Array<'WINDOWS' | 'MAC_OS' | 'I_OS' | 'LINUX' | 'ANDROID' | 'WINDOWS_PHONE' | 'OTHERS'>, include?: boolean | undefined}; export type SdkFilter1 = {type: string, include?: boolean | undefined, values: Array<'JAVA' | 'ANDROID' | 'GO' | 'DOTNET' | 'PYTHON' | 'RUBY' | 'IOS' | 'PHP' | 'JAVASCRIPT' | 'NODEJS' | 'REACT' | 'RUST' | 'ELIXIR'>}; export type VisitorDeviceDataFilters = AdBlockerFilter | BrowserFilter | BrowserLanguageFilter | DeviceTypeFilter | NewVisitorFilter | OperatingSystemFilter | SdkFilter1; export type ContaminatedVisitorFilter = {type: string, include?: boolean | undefined}; export type FilterContainer1 = {param?: ('GREATER' | 'LOWER' | 'EQUAL' | 'EXACT' | 'INCLUDE' | 'LOWER_OR_EQUAL' | 'GREATER_OR_EQUAL' | 'TRUE' | 'FALSE' | 'UNDEFINED' | 'BETWEEN') | undefined, value?: number | undefined, unit?: ('SECONDS' | 'MINUTES' | 'HOURS' | 'DAYS' | 'WEEKS') | undefined}; export type NumberPagesFilter1 = {type: string, values: Array, include?: boolean | undefined}; export type NumberVisitsFilter = {type: string, values: Array, include?: boolean | undefined}; export type SinceLastVisitFilter = {type: string, values: Array, include?: boolean | undefined}; export type TimeSpentFilter = {type: string, values: Array, include?: boolean | undefined}; export type VisitBehaviorDataFilters = ContaminatedVisitorFilter | NumberPagesFilter1 | NumberVisitsFilter | SinceLastVisitFilter | TimeSpentFilter; export type FirstReferrerFilter = {type: string, values: Array, include?: boolean | undefined}; export type KeyPageFilter = {type: string, values?: Array | undefined, include?: boolean | undefined}; export type LandingPageURLFilter = {type: string, values: Array, include?: boolean | undefined}; export type PageTitleFilter = {type: string, values: Array, include?: boolean | undefined}; export type PageURLFilter = {type: string, values: Array, include?: boolean | undefined}; export type ReferrerURLFilter = {type: string, values: Array, include?: boolean | undefined}; export type TrafficFilter1 = {type: string, values: Array<'SEO' | 'SEM' | 'AFFILIATION' | 'EMAIL' | 'DIRECT'>, include?: boolean | undefined}; export type PageTrafficDataFilters = FirstReferrerFilter | KeyPageFilter | LandingPageURLFilter | PageTitleFilter | PageURLFilter | ReferrerURLFilter | TrafficFilter1; export type ConversionMetadataFilter = {type: string, include?: boolean | undefined, goalId?: number | undefined, index?: number | undefined, value?: string | undefined}; export type ConversionsFilter = {type: string, values: Array, include?: boolean | undefined}; export type ConversionDataFilters = ConversionMetadataFilter | ConversionsFilter; export type CustomDataFilter = {type: string, include?: boolean | undefined, customDataId: number, value?: string | undefined}; export type ExperimentDataFilter = {type: string, id: number, variationIds: Array, include?: boolean | undefined}; export type PersonalizationDataFilter = {type: string, id: number, exposition?: ('ALL' | 'EXPOSED' | 'NOT_EXPOSED') | undefined, include?: boolean | undefined}; export type TargetingSegmentFilter = {type: string, values: Array, include?: boolean | undefined}; export type ExperimentPersonalizationDataFilters = CustomDataFilter | ExperimentDataFilter | PersonalizationDataFilter | TargetingSegmentFilter; export type DayFilter = {type: string, include?: boolean | undefined}; export type TimeSlotFilter = {type: string, include?: boolean | undefined, visitorCalendar?: boolean | undefined, values?: Array> | undefined}; export type WeekdayFilter = {type: string, values: Array<'SUNDAY' | 'MONDAY' | 'TUESDAY' | 'WEDNESDAY' | 'THURSDAY' | 'FRIDAY' | 'SATURDAY'>, include?: boolean | undefined, visitorCalendar?: boolean | undefined}; export type TimeDataFilters = DayFilter | TimeSlotFilter | WeekdayFilter; export type TemperatureFilter1 = {type: string, include?: boolean | undefined, param: 'GREATER' | 'LOWER' | 'EQUAL' | 'EXACT' | 'INCLUDE' | 'LOWER_OR_EQUAL' | 'GREATER_OR_EQUAL' | 'TRUE' | 'FALSE' | 'UNDEFINED' | 'BETWEEN', from: number, to?: number | undefined}; export type WeatherFilter = {type: string, values: Array<'CLEAR_SKY' | 'CLOUDS' | 'RAIN' | 'THUNDERSTORM' | 'SNOW' | 'HAIL' | 'WIND' | 'ATMOSPHERIC_DISTURBANCES'>, include?: boolean | undefined}; export type EnvironmentDataFilters = TemperatureFilter1 | WeatherFilter; export type DateInterval = {start?: string | undefined, end?: string | undefined}; export type ExportOptions = {format?: ('XLSX' | 'PDF') | undefined, view?: ('PER_GOAL' | 'PER_VARIATION' | 'PER_AUDIENCE') | undefined, columns?: (Array<'VISITS' | 'VISITORS' | 'VISITS_CONVERTED' | 'VISITORS_CONVERTED' | 'ALL_CONVERSIONS' | 'RATIO_VALUE' | 'REVENUE_PER_VISIT' | 'REVENUE_PER_VISITOR' | 'AVERAGE_CART_VISITS' | 'AVERAGE_CART_VISITORS' | 'CONVERSION_RATE_VISITS' | 'IMPROVEMENT_RATE_VISITS' | 'RELIABILITY_RATE_VISITS' | 'CONVERSION_RATE_VISITORS' | 'IMPROVEMENT_RATE_VISITORS' | 'RELIABILITY_RATE_VISITORS' | 'PROBABILITY_TO_WIN' | 'CREDIBLE_INTERVAL' | 'IMPROVEMENT_RANGE_DEFAULT' | 'CONVERSION_RATE_CUPED' | 'IMPROVEMENT_RATE_CUPED' | 'RELIABILITY_RATE_CUPED' | 'IMPROVEMENT_RANGE_CUPED' | 'REVENUE'>) | undefined, filterLabels?: Array | undefined, variationsIds?: Array | undefined, useReferenceVariation?: boolean | undefined}; export type DataExportRequestParams = {visitorData?: boolean | undefined, allVariationsData?: boolean | undefined, bayesian?: boolean | undefined, sequentialTesting?: boolean | undefined, enabledMultipleTesting?: boolean | undefined, referenceVariationId?: string | undefined, breakdown?: (Breakdown | ConversionMetadataBreakdownIO1 | CrossCampaignBreakdownIO1 | CustomDatumBreakdownIO | IntervalBreakdownIO1) | undefined, goalsIds?: Array | undefined, goalIdsCuped?: Array | undefined, filters?: (Array) | undefined, dateIntervals: Array, conversionType: 'ALL_CONVERSION' | 'CONVERTED_VISITS', callbackUrl?: string | undefined, exportOptions?: ExportOptions | undefined}; export type CreateApiPersonalizationsPersonalizationIdInitExportArgs = {personalizationId: number, body: DataExportRequestParams}; export type CreateApiPersonalizationsPersonalizationIdInitExportOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Export personalization results * * POST /personalizations/{personalizationId}/init-export */ export const createApiPersonalizationsPersonalizationIdInitExport = async (args: CreateApiPersonalizationsPersonalizationIdInitExportArgs, options?: CreateApiPersonalizationsPersonalizationIdInitExportOptions) => { const {baseUrl = "https://api.kameleoon.com", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "*/*") if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/personalizations/${encodeURIComponent(String(args.personalizationId))}/init-export${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };