@shware/analytics 11.7.0 → 11.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -0
- package/dist/ads/index.cjs +11 -0
- package/dist/ads/index.d.cts +4 -0
- package/dist/ads/index.d.mts +4 -0
- package/dist/ads/index.mjs +3 -0
- package/dist/ads/meta.cjs +323 -0
- package/dist/ads/meta.cjs.map +1 -0
- package/dist/ads/meta.d.cts +68 -0
- package/dist/ads/meta.d.cts.map +1 -0
- package/dist/ads/meta.d.mts +68 -0
- package/dist/ads/meta.d.mts.map +1 -0
- package/dist/ads/meta.mjs +319 -0
- package/dist/ads/meta.mjs.map +1 -0
- package/dist/ads/time.cjs +59 -0
- package/dist/ads/time.cjs.map +1 -0
- package/dist/ads/time.d.cts +17 -0
- package/dist/ads/time.d.cts.map +1 -0
- package/dist/ads/time.d.mts +17 -0
- package/dist/ads/time.d.mts.map +1 -0
- package/dist/ads/time.mjs +55 -0
- package/dist/ads/time.mjs.map +1 -0
- package/dist/ads/types.cjs +0 -0
- package/dist/ads/types.d.cts +57 -0
- package/dist/ads/types.d.cts.map +1 -0
- package/dist/ads/types.d.mts +57 -0
- package/dist/ads/types.d.mts.map +1 -0
- package/dist/ads/types.mjs +1 -0
- package/package.json +11 -1
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { ChannelGroup } from "../attribution/vocabulary.mjs";
|
|
2
|
+
//#region src/ads/types.d.ts
|
|
3
|
+
/** The ad platforms whose reporting APIs this module reads. */
|
|
4
|
+
export type AdPlatform = 'meta';
|
|
5
|
+
/**
|
|
6
|
+
* One row of ad delivery: one ad over one hour. The row a host stores in its `ad_performance`
|
|
7
|
+
* table, unique on (`platform`, `account_id`, `ad_id`, `hour_start`).
|
|
8
|
+
*
|
|
9
|
+
* Every platform yields hourly rows, so that a sum over any span in any time zone — the way the
|
|
10
|
+
* host's attribution is grouped — is a sum of whole rows, and a table never mixes a day row with
|
|
11
|
+
* the hour rows inside it (an upsert would overwrite one with the other on the shared start, and
|
|
12
|
+
* the rest would count twice). A platform that reports only days spreads each day evenly over its
|
|
13
|
+
* hours, the counts then fractional.
|
|
14
|
+
*
|
|
15
|
+
* `channel`, `medium` and `channel_group` use the attribution vocabulary (`classifyTouch`), so a
|
|
16
|
+
* row joins the host's sessions and attribution on the same values with no mapping in SQL.
|
|
17
|
+
*/
|
|
18
|
+
export interface AdPerformanceRow {
|
|
19
|
+
/** The reporting API the row came from; `channel` is what it joins attribution on. */
|
|
20
|
+
platform: AdPlatform;
|
|
21
|
+
/** The platform's account id, without a prefix (Meta's `act_` is stripped). */
|
|
22
|
+
account_id: string;
|
|
23
|
+
campaign_id: string;
|
|
24
|
+
campaign_name: string | null;
|
|
25
|
+
/** The level between campaign and ad: Meta's ad set. */
|
|
26
|
+
ad_group_id: string | null;
|
|
27
|
+
ad_group_name: string | null;
|
|
28
|
+
ad_id: string;
|
|
29
|
+
ad_name: string | null;
|
|
30
|
+
channel: string;
|
|
31
|
+
medium: string;
|
|
32
|
+
channel_group: ChannelGroup;
|
|
33
|
+
/** The start of the hour, an ISO 8601 UTC instant; the row covers the hour that follows. */
|
|
34
|
+
hour_start: string;
|
|
35
|
+
/** The account's currency, ISO 4217; every amount of the row is in it. */
|
|
36
|
+
currency: string;
|
|
37
|
+
spend: number;
|
|
38
|
+
impressions: number;
|
|
39
|
+
/**
|
|
40
|
+
* Clicks to the advertiser's site — Meta's `inline_link_clicks`, not `clicks`, which also counts
|
|
41
|
+
* likes, expands and profile taps. The number to compare with the sessions an ad brought.
|
|
42
|
+
*/
|
|
43
|
+
clicks: number;
|
|
44
|
+
/**
|
|
45
|
+
* The platform's own count of the conversion event (and its value) under the attribution
|
|
46
|
+
* setting of the ad — view-through included. Null when the platform reported none.
|
|
47
|
+
*/
|
|
48
|
+
conversions: number | null;
|
|
49
|
+
conversion_value: number | null;
|
|
50
|
+
/** The click-through part only: the platform's number to set against a click-based attribution. */
|
|
51
|
+
click_conversions: number | null;
|
|
52
|
+
click_conversion_value: number | null;
|
|
53
|
+
}
|
|
54
|
+
/** A calendar date, `YYYY-MM-DD`, in the ad account's own time zone. */
|
|
55
|
+
export type ReportDate = `${number}-${number}-${number}`;
|
|
56
|
+
//#endregion
|
|
57
|
+
//# sourceMappingURL=types.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.mts","names":[],"sources":["../../src/ads/types.ts"],"mappings":";;;YAGY;;;;;;;;;;;;;;iBAeK;;EAEf,UAAU;;EAEV;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA,eAAe;;EAEf;;EAEA;EACA;EACA;;;;;EAKA;;;;;EAKA;EACA;;EAEA;EACA;;;YAIU"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shware/analytics",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.9.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -21,6 +21,16 @@
|
|
|
21
21
|
"default": "./dist/index.cjs"
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
|
+
"./ads": {
|
|
25
|
+
"import": {
|
|
26
|
+
"types": "./dist/ads/index.d.mts",
|
|
27
|
+
"default": "./dist/ads/index.mjs"
|
|
28
|
+
},
|
|
29
|
+
"require": {
|
|
30
|
+
"types": "./dist/ads/index.d.cts",
|
|
31
|
+
"default": "./dist/ads/index.cjs"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
24
34
|
"./attribution": {
|
|
25
35
|
"import": {
|
|
26
36
|
"types": "./dist/attribution/index.d.mts",
|