opscms-analytics-plugin 1.0.3 → 1.0.4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.4
4
+
5
+ LinkedIn Insight Tag as a provider: a site enters its Partner ID, and the website loads the tag for visitors who allow marketing cookies, with nothing to add in a tag manager. The ID is checked when saved (a number). Adds a database change (the new provider).
6
+
3
7
  ## 1.0.3
4
8
 
5
9
  The GA4 server secret is readable again by the ga4-send-event action: the field returned the mask to every caller, so server events would have been sent with "••••••••" as the API secret. It now gives the real value, decrypted, to the one caller that asks for it (context.preventMasking) and the mask to everyone else. No database change.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Per-site analytics for the OpsCMS platform, built with [`opscms-sdk`](../opscms-sdk).
4
4
 
5
- - **`analytics-integrations`**: each site's own analytics providers: Google (GA4 and Tag Manager), Matomo, Plausible, Fathom, Umami, PostHog, or a custom
5
+ - **`analytics-integrations`**: each site's own analytics providers: Google (GA4 and Tag Manager), LinkedIn Insight Tag, Matomo, Plausible, Fathom, Umami, PostHog, or a custom
6
6
  script. A site can run several at once. The server secret (GA4's Measurement Protocol secret) is encrypted under the site's key and shown masked; the
7
7
  platform's public content API never returns it. A **custom script** is injected verbatim into every page of the site, so only the platform owner may write one.
8
8
  - **The `ga4-send-event` workflow action**: carries out the platform's `send_analytics_event` block, sending a server-side event to GA4 with the site's own
package/dist/index.d.mts CHANGED
@@ -40,8 +40,8 @@ declare const analyticsManifest: opscms_sdk.PluginManifest;
40
40
  * every page of the site: as part of a script address and inside an inline snippet. So each is held to the shape a real one has, and
41
41
  * nothing that could end a string or a tag is accepted. (The component that renders them escapes them as well; this is the first line.)
42
42
  */
43
- /** `true`, or the sentence that tells the person what is wrong. Empty is allowed: the field is optional. */
44
- declare function trackingIdProblem(value: unknown): true | string;
43
+ /** `true`, or the sentence that tells the person what is wrong. Empty is allowed (the field is optional), except for LinkedIn, which is nothing without its ID. */
44
+ declare function trackingIdProblem(value: unknown, provider?: unknown): true | string;
45
45
  declare function tagIdProblem(value: unknown): true | string;
46
46
  declare function serverUrlProblem(value: unknown): true | string;
47
47
 
@@ -62,7 +62,7 @@ declare function buildGa4Body(args: {
62
62
  declare function ga4SendHandler(ctx: WorkflowActionContext): Promise<WorkflowStepResult>;
63
63
 
64
64
  /**
65
- * Per-site analytics: the `analytics-integrations` collection (each site's own Google, Matomo, Plausible, Fathom, Umami, PostHog or custom settings, with the
65
+ * Per-site analytics: the `analytics-integrations` collection (each site's own Google, LinkedIn, Matomo, Plausible, Fathom, Umami, PostHog or custom settings, with the
66
66
  * secret encrypted), and the server-side GA4 workflow action (`ga4-send-event`) that reads them for the platform's `send_analytics_event` block.
67
67
  *
68
68
  * Meta's own server-side events are the Meta plugin's (`meta-conversion-event`), not this plugin's.
package/dist/index.d.ts CHANGED
@@ -40,8 +40,8 @@ declare const analyticsManifest: opscms_sdk.PluginManifest;
40
40
  * every page of the site: as part of a script address and inside an inline snippet. So each is held to the shape a real one has, and
41
41
  * nothing that could end a string or a tag is accepted. (The component that renders them escapes them as well; this is the first line.)
42
42
  */
43
- /** `true`, or the sentence that tells the person what is wrong. Empty is allowed: the field is optional. */
44
- declare function trackingIdProblem(value: unknown): true | string;
43
+ /** `true`, or the sentence that tells the person what is wrong. Empty is allowed (the field is optional), except for LinkedIn, which is nothing without its ID. */
44
+ declare function trackingIdProblem(value: unknown, provider?: unknown): true | string;
45
45
  declare function tagIdProblem(value: unknown): true | string;
46
46
  declare function serverUrlProblem(value: unknown): true | string;
47
47
 
@@ -62,7 +62,7 @@ declare function buildGa4Body(args: {
62
62
  declare function ga4SendHandler(ctx: WorkflowActionContext): Promise<WorkflowStepResult>;
63
63
 
64
64
  /**
65
- * Per-site analytics: the `analytics-integrations` collection (each site's own Google, Matomo, Plausible, Fathom, Umami, PostHog or custom settings, with the
65
+ * Per-site analytics: the `analytics-integrations` collection (each site's own Google, LinkedIn, Matomo, Plausible, Fathom, Umami, PostHog or custom settings, with the
66
66
  * secret encrypted), and the server-side GA4 workflow action (`ga4-send-event`) that reads them for the platform's `send_analytics_event` block.
67
67
  *
68
68
  * Meta's own server-side events are the Meta plugin's (`meta-conversion-event`), not this plugin's.
package/dist/index.js CHANGED
@@ -40,7 +40,11 @@ var import_opscms_sdk = require("opscms-sdk");
40
40
  // src/integrationValues.ts
41
41
  var ID = /^[A-Za-z0-9._:/-]{1,100}$/;
42
42
  var TAG = /^[A-Za-z0-9_-]{1,40}$/;
43
- function trackingIdProblem(value) {
43
+ var LINKEDIN_PARTNER = /^\d{3,12}$/;
44
+ function trackingIdProblem(value, provider) {
45
+ if (provider === "linkedin") {
46
+ return typeof value === "string" && LINKEDIN_PARTNER.test(value) ? true : "Enter the LinkedIn Partner ID: the number Campaign Manager shows with the Insight Tag, for example 1234567.";
47
+ }
44
48
  if (value === void 0 || value === null || value === "") return true;
45
49
  return typeof value === "string" && ID.test(value) ? true : "A tracking or site ID has only letters, digits and . _ : / - (for example G-ABC123, 3, or example.com).";
46
50
  }
@@ -117,6 +121,7 @@ var AnalyticsIntegrations = {
117
121
  { label: "Fathom", value: "fathom" },
118
122
  { label: "Umami", value: "umami" },
119
123
  { label: "PostHog", value: "posthog" },
124
+ { label: "LinkedIn Insight Tag", value: "linkedin" },
120
125
  { label: "Custom", value: "custom" }
121
126
  ]
122
127
  },
@@ -124,10 +129,10 @@ var AnalyticsIntegrations = {
124
129
  {
125
130
  name: "trackingId",
126
131
  type: "text",
127
- validate: (value) => trackingIdProblem(value),
132
+ validate: (value, { siblingData }) => trackingIdProblem(value, siblingData?.provider),
128
133
  admin: {
129
- description: "Measurement / tracking ID \u2014 GA4 measurement ID (G-XXXX) for Google, or site ID for others. Leave blank if only using Tag Manager.",
130
- condition: (_data, siblingData) => ["google", "matomo", "plausible", "fathom", "umami", "posthog"].includes(
134
+ description: "Measurement / tracking ID \u2014 GA4 measurement ID (G-XXXX) for Google, the Partner ID for LinkedIn, or the site ID for others. Leave blank if only using Tag Manager. The LinkedIn tag loads only for visitors who allow marketing cookies; do not also add it through a tag manager.",
135
+ condition: (_data, siblingData) => ["google", "matomo", "plausible", "fathom", "umami", "posthog", "linkedin"].includes(
131
136
  siblingData?.provider
132
137
  )
133
138
  }
@@ -206,10 +211,15 @@ var import_opscms_sdk2 = require("opscms-sdk");
206
211
  var analyticsManifest = (0, import_opscms_sdk2.definePluginManifest)({
207
212
  key: "analytics",
208
213
  name: "Analytics & Insights",
209
- description: "Analytics integrations per site: Google (GA4 and Tag Manager), Matomo, Plausible, Fathom, Umami, PostHog or a custom script; server-side GA4 events; and the marketing dashboard. (Meta Pixel belongs to the Meta plugin.)",
214
+ description: "Analytics integrations per site: Google (GA4 and Tag Manager), LinkedIn Insight Tag, Matomo, Plausible, Fathom, Umami, PostHog or a custom script; server-side GA4 events; and the marketing dashboard. (Meta Pixel belongs to the Meta plugin.)",
210
215
  category: "analytics",
211
216
  icon: "icon.svg",
212
217
  releases: [
218
+ {
219
+ version: "1.0.4",
220
+ date: "2026-11-30",
221
+ notes: ["LinkedIn Insight Tag as a provider: a site enters its Partner ID, and the website loads the tag for visitors who allow marketing cookies, with nothing to add in a tag manager. The ID is checked when saved (a number)."]
222
+ },
213
223
  {
214
224
  version: "1.0.3",
215
225
  date: "2026-11-17",
@@ -350,13 +360,17 @@ var migration = (0, import_opscms_sdk4.sqlMigration)("analytics:20261108_100000_
350
360
  `DROP TYPE IF EXISTS "public"."enum_analytics_integrations_provider"`
351
361
  ]
352
362
  });
363
+ var linkedinProvider = (0, import_opscms_sdk4.sqlMigration)("analytics:20261130_100000_linkedin_provider", {
364
+ up: [`ALTER TYPE "public"."enum_analytics_integrations_provider" ADD VALUE IF NOT EXISTS 'linkedin' BEFORE 'custom'`],
365
+ down: []
366
+ });
353
367
 
354
368
  // src/index.ts
355
369
  var analyticsPlugin = (0, import_opscms_sdk5.definePlugin)({
356
370
  manifest: analyticsManifest,
357
371
  collections: [AnalyticsIntegrations],
358
372
  workflowActions: marketingActions,
359
- migrations: [migration]
373
+ migrations: [migration, linkedinProvider]
360
374
  });
361
375
  // Annotate the CommonJS export names for ESM import in node:
362
376
  0 && (module.exports = {
package/dist/index.mjs CHANGED
@@ -7,7 +7,11 @@ import { access, platform, secretField, SETTINGS_MASK, tenancy } from "opscms-sd
7
7
  // src/integrationValues.ts
8
8
  var ID = /^[A-Za-z0-9._:/-]{1,100}$/;
9
9
  var TAG = /^[A-Za-z0-9_-]{1,40}$/;
10
- function trackingIdProblem(value) {
10
+ var LINKEDIN_PARTNER = /^\d{3,12}$/;
11
+ function trackingIdProblem(value, provider) {
12
+ if (provider === "linkedin") {
13
+ return typeof value === "string" && LINKEDIN_PARTNER.test(value) ? true : "Enter the LinkedIn Partner ID: the number Campaign Manager shows with the Insight Tag, for example 1234567.";
14
+ }
11
15
  if (value === void 0 || value === null || value === "") return true;
12
16
  return typeof value === "string" && ID.test(value) ? true : "A tracking or site ID has only letters, digits and . _ : / - (for example G-ABC123, 3, or example.com).";
13
17
  }
@@ -84,6 +88,7 @@ var AnalyticsIntegrations = {
84
88
  { label: "Fathom", value: "fathom" },
85
89
  { label: "Umami", value: "umami" },
86
90
  { label: "PostHog", value: "posthog" },
91
+ { label: "LinkedIn Insight Tag", value: "linkedin" },
87
92
  { label: "Custom", value: "custom" }
88
93
  ]
89
94
  },
@@ -91,10 +96,10 @@ var AnalyticsIntegrations = {
91
96
  {
92
97
  name: "trackingId",
93
98
  type: "text",
94
- validate: (value) => trackingIdProblem(value),
99
+ validate: (value, { siblingData }) => trackingIdProblem(value, siblingData?.provider),
95
100
  admin: {
96
- description: "Measurement / tracking ID \u2014 GA4 measurement ID (G-XXXX) for Google, or site ID for others. Leave blank if only using Tag Manager.",
97
- condition: (_data, siblingData) => ["google", "matomo", "plausible", "fathom", "umami", "posthog"].includes(
101
+ description: "Measurement / tracking ID \u2014 GA4 measurement ID (G-XXXX) for Google, the Partner ID for LinkedIn, or the site ID for others. Leave blank if only using Tag Manager. The LinkedIn tag loads only for visitors who allow marketing cookies; do not also add it through a tag manager.",
102
+ condition: (_data, siblingData) => ["google", "matomo", "plausible", "fathom", "umami", "posthog", "linkedin"].includes(
98
103
  siblingData?.provider
99
104
  )
100
105
  }
@@ -173,10 +178,15 @@ import { definePluginManifest } from "opscms-sdk";
173
178
  var analyticsManifest = definePluginManifest({
174
179
  key: "analytics",
175
180
  name: "Analytics & Insights",
176
- description: "Analytics integrations per site: Google (GA4 and Tag Manager), Matomo, Plausible, Fathom, Umami, PostHog or a custom script; server-side GA4 events; and the marketing dashboard. (Meta Pixel belongs to the Meta plugin.)",
181
+ description: "Analytics integrations per site: Google (GA4 and Tag Manager), LinkedIn Insight Tag, Matomo, Plausible, Fathom, Umami, PostHog or a custom script; server-side GA4 events; and the marketing dashboard. (Meta Pixel belongs to the Meta plugin.)",
177
182
  category: "analytics",
178
183
  icon: "icon.svg",
179
184
  releases: [
185
+ {
186
+ version: "1.0.4",
187
+ date: "2026-11-30",
188
+ notes: ["LinkedIn Insight Tag as a provider: a site enters its Partner ID, and the website loads the tag for visitors who allow marketing cookies, with nothing to add in a tag manager. The ID is checked when saved (a number)."]
189
+ },
180
190
  {
181
191
  version: "1.0.3",
182
192
  date: "2026-11-17",
@@ -317,13 +327,17 @@ var migration = sqlMigration("analytics:20261108_100000_create_integrations", {
317
327
  `DROP TYPE IF EXISTS "public"."enum_analytics_integrations_provider"`
318
328
  ]
319
329
  });
330
+ var linkedinProvider = sqlMigration("analytics:20261130_100000_linkedin_provider", {
331
+ up: [`ALTER TYPE "public"."enum_analytics_integrations_provider" ADD VALUE IF NOT EXISTS 'linkedin' BEFORE 'custom'`],
332
+ down: []
333
+ });
320
334
 
321
335
  // src/index.ts
322
336
  var analyticsPlugin = definePlugin({
323
337
  manifest: analyticsManifest,
324
338
  collections: [AnalyticsIntegrations],
325
339
  workflowActions: marketingActions,
326
- migrations: [migration]
340
+ migrations: [migration, linkedinProvider]
327
341
  });
328
342
  export {
329
343
  ANALYTICS_INTEGRATIONS,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opscms-analytics-plugin",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Per-site analytics for an OpsCMS platform: each site's own Google, Matomo, Plausible, Fathom, Umami, PostHog or custom settings, and the server-side GA4 workflow action.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",