@misiki/gocommerce-connector 0.20.0 → 0.21.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/dist/index.cjs +11 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -1
- package/dist/services/index.cjs +11 -0
- package/dist/services/index.cjs.map +1 -1
- package/dist/services/index.js +11 -0
- package/dist/services/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3184,6 +3184,7 @@ var StoreService = class extends BaseService {
|
|
|
3184
3184
|
// one storefront serves every store, and one store's pixel must never
|
|
3185
3185
|
// load on another's pages.
|
|
3186
3186
|
...adTags(plugins),
|
|
3187
|
+
googleTagManager: googleTags(plugins),
|
|
3187
3188
|
// Discount codes are core: every GoCommerce store takes them, so
|
|
3188
3189
|
// the code box is shown whatever the static record says.
|
|
3189
3190
|
isDiscountCoupons: { ...basePlugins.isDiscountCoupons, active: true },
|
|
@@ -3225,6 +3226,16 @@ function adTags(plugins) {
|
|
|
3225
3226
|
})
|
|
3226
3227
|
);
|
|
3227
3228
|
}
|
|
3229
|
+
function googleTags(plugins) {
|
|
3230
|
+
const s = plugins.get("google-analytics")?.settings ?? {};
|
|
3231
|
+
const id2 = (field) => String(s[field] ?? "").trim();
|
|
3232
|
+
const [account, part] = id2("conversion_label").split("/");
|
|
3233
|
+
const label = part === void 0 ? account : part;
|
|
3234
|
+
const ads = id2("google_ads_id") || (part === void 0 ? "" : account);
|
|
3235
|
+
const tags = [id2("ga4_measurement_id"), ads, id2("gtm_container_id")].filter(Boolean);
|
|
3236
|
+
if (!tags.length) return { active: false };
|
|
3237
|
+
return { active: true, tags, conversions: ads && label ? [{ event: "purchase", label }] : [] };
|
|
3238
|
+
}
|
|
3228
3239
|
function deliverable(base, ships) {
|
|
3229
3240
|
if (ships.everywhere || !ships.countries.length) return {};
|
|
3230
3241
|
const known = new Map((base.countries ?? []).map((c) => [String(c.code).toUpperCase(), c]));
|