@ohos-ports/vite-plugin-radar 0.11.0-beta.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/LICENSE +21 -0
- package/README.md +337 -0
- package/dist/chunks/index.cjs +69 -0
- package/dist/chunks/index.mjs +67 -0
- package/dist/chunks/index10.cjs +30 -0
- package/dist/chunks/index10.mjs +28 -0
- package/dist/chunks/index11.cjs +29 -0
- package/dist/chunks/index11.mjs +27 -0
- package/dist/chunks/index12.cjs +28 -0
- package/dist/chunks/index12.mjs +26 -0
- package/dist/chunks/index13.cjs +48 -0
- package/dist/chunks/index13.mjs +46 -0
- package/dist/chunks/index14.cjs +39 -0
- package/dist/chunks/index14.mjs +37 -0
- package/dist/chunks/index15.cjs +28 -0
- package/dist/chunks/index15.mjs +26 -0
- package/dist/chunks/index16.cjs +27 -0
- package/dist/chunks/index16.mjs +25 -0
- package/dist/chunks/index2.cjs +39 -0
- package/dist/chunks/index2.mjs +37 -0
- package/dist/chunks/index3.cjs +43 -0
- package/dist/chunks/index3.mjs +41 -0
- package/dist/chunks/index4.cjs +38 -0
- package/dist/chunks/index4.mjs +36 -0
- package/dist/chunks/index5.cjs +37 -0
- package/dist/chunks/index5.mjs +35 -0
- package/dist/chunks/index6.cjs +42 -0
- package/dist/chunks/index6.mjs +40 -0
- package/dist/chunks/index7.cjs +40 -0
- package/dist/chunks/index7.mjs +38 -0
- package/dist/chunks/index8.cjs +29 -0
- package/dist/chunks/index8.mjs +27 -0
- package/dist/chunks/index9.cjs +26 -0
- package/dist/chunks/index9.mjs +24 -0
- package/dist/index.cjs +57 -0
- package/dist/index.d.cts +451 -0
- package/dist/index.d.mts +451 -0
- package/dist/index.d.ts +451 -0
- package/dist/index.mjs +54 -0
- package/package.json +36 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const defaults = {
|
|
4
|
+
script: "analytics.tiktok.com/i18n/pixel/events.js",
|
|
5
|
+
methods: ["page", "track", "identify", "instances", "debug", "on", "off", "once", "ready", "alias", "group", "enableCookie", "disableCookie"],
|
|
6
|
+
page: "ttq.page()"
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
function injectTag(options) {
|
|
10
|
+
const tags = [];
|
|
11
|
+
if (!options.id)
|
|
12
|
+
return tags;
|
|
13
|
+
const { id, script: sourceLocation, methods, page } = { ...defaults, ...options };
|
|
14
|
+
const methodsAsString = methods.map((s) => `"${s}"`).join(", ");
|
|
15
|
+
let template = "";
|
|
16
|
+
template += "!(function (w, d, t) {";
|
|
17
|
+
template += "w.TiktokAnalyticsObject = t;";
|
|
18
|
+
template += "var ttq = (w[t] = w[t] || []);";
|
|
19
|
+
template += `(ttq.methods = [${methodsAsString}]),`;
|
|
20
|
+
template += "(ttq.setAndDefer = function (t, e) {";
|
|
21
|
+
template += "t[e] = function () {";
|
|
22
|
+
template += "t.push([e].concat(Array.prototype.slice.call(arguments, 0)));";
|
|
23
|
+
template += "};";
|
|
24
|
+
template += "});";
|
|
25
|
+
template += "for (var i = 0; i < ttq.methods.length; i++) ttq.setAndDefer(ttq, ttq.methods[i]);";
|
|
26
|
+
template += "(ttq.instance = function (t) {";
|
|
27
|
+
template += "for (var e = ttq._i[t] || [], n = 0; n < ttq.methods.length; n++) ttq.setAndDefer(e, ttq.methods[n]);";
|
|
28
|
+
template += "return e;";
|
|
29
|
+
template += "}),";
|
|
30
|
+
template += "(ttq.load = function (e, n) {";
|
|
31
|
+
template += `var i = ("https:" == document.location.protocol ? "https://" : "http://") + "${sourceLocation}";`;
|
|
32
|
+
template += "(ttq._i = ttq._i || {}), (ttq._i[e] = []), (ttq._i[e]._u = i), (ttq._t = ttq._t || {}), (ttq._t[e] = +new Date()), (ttq._o = ttq._o || {}), (ttq._o[e] = n || {});";
|
|
33
|
+
template += 'var o = document.createElement("script");';
|
|
34
|
+
template += '(o.type = "text/javascript"), (o.async = !0), (o.src = i + "?sdkid=" + e + "&lib=" + t);';
|
|
35
|
+
template += 'var a = document.getElementsByTagName("script")[0];';
|
|
36
|
+
template += "a.parentNode.insertBefore(o, a);";
|
|
37
|
+
template += "});";
|
|
38
|
+
template += `ttq.load("${id}");`;
|
|
39
|
+
template += `${page};`;
|
|
40
|
+
template += '})(window, document, "ttq");';
|
|
41
|
+
tags.push({
|
|
42
|
+
tag: "script",
|
|
43
|
+
children: template
|
|
44
|
+
});
|
|
45
|
+
return tags;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
exports.default = injectTag;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const defaults = {
|
|
2
|
+
script: "analytics.tiktok.com/i18n/pixel/events.js",
|
|
3
|
+
methods: ["page", "track", "identify", "instances", "debug", "on", "off", "once", "ready", "alias", "group", "enableCookie", "disableCookie"],
|
|
4
|
+
page: "ttq.page()"
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
function injectTag(options) {
|
|
8
|
+
const tags = [];
|
|
9
|
+
if (!options.id)
|
|
10
|
+
return tags;
|
|
11
|
+
const { id, script: sourceLocation, methods, page } = { ...defaults, ...options };
|
|
12
|
+
const methodsAsString = methods.map((s) => `"${s}"`).join(", ");
|
|
13
|
+
let template = "";
|
|
14
|
+
template += "!(function (w, d, t) {";
|
|
15
|
+
template += "w.TiktokAnalyticsObject = t;";
|
|
16
|
+
template += "var ttq = (w[t] = w[t] || []);";
|
|
17
|
+
template += `(ttq.methods = [${methodsAsString}]),`;
|
|
18
|
+
template += "(ttq.setAndDefer = function (t, e) {";
|
|
19
|
+
template += "t[e] = function () {";
|
|
20
|
+
template += "t.push([e].concat(Array.prototype.slice.call(arguments, 0)));";
|
|
21
|
+
template += "};";
|
|
22
|
+
template += "});";
|
|
23
|
+
template += "for (var i = 0; i < ttq.methods.length; i++) ttq.setAndDefer(ttq, ttq.methods[i]);";
|
|
24
|
+
template += "(ttq.instance = function (t) {";
|
|
25
|
+
template += "for (var e = ttq._i[t] || [], n = 0; n < ttq.methods.length; n++) ttq.setAndDefer(e, ttq.methods[n]);";
|
|
26
|
+
template += "return e;";
|
|
27
|
+
template += "}),";
|
|
28
|
+
template += "(ttq.load = function (e, n) {";
|
|
29
|
+
template += `var i = ("https:" == document.location.protocol ? "https://" : "http://") + "${sourceLocation}";`;
|
|
30
|
+
template += "(ttq._i = ttq._i || {}), (ttq._i[e] = []), (ttq._i[e]._u = i), (ttq._t = ttq._t || {}), (ttq._t[e] = +new Date()), (ttq._o = ttq._o || {}), (ttq._o[e] = n || {});";
|
|
31
|
+
template += 'var o = document.createElement("script");';
|
|
32
|
+
template += '(o.type = "text/javascript"), (o.async = !0), (o.src = i + "?sdkid=" + e + "&lib=" + t);';
|
|
33
|
+
template += 'var a = document.getElementsByTagName("script")[0];';
|
|
34
|
+
template += "a.parentNode.insertBefore(o, a);";
|
|
35
|
+
template += "});";
|
|
36
|
+
template += `ttq.load("${id}");`;
|
|
37
|
+
template += `${page};`;
|
|
38
|
+
template += '})(window, document, "ttq");';
|
|
39
|
+
tags.push({
|
|
40
|
+
tag: "script",
|
|
41
|
+
children: template
|
|
42
|
+
});
|
|
43
|
+
return tags;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export { injectTag as default };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const defaults = {
|
|
4
|
+
script: "https://scripts.simpleanalyticscdn.com/latest.js",
|
|
5
|
+
noScript: "https://queue.simpleanalyticscdn.com/noscript.gif",
|
|
6
|
+
async: true,
|
|
7
|
+
defer: true
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
function injectTag(options) {
|
|
11
|
+
const tags = [];
|
|
12
|
+
if (!options.enabled)
|
|
13
|
+
return tags;
|
|
14
|
+
const { script, noScript, async, defer, hostname } = { ...defaults, ...options };
|
|
15
|
+
let noScriptUrl = noScript;
|
|
16
|
+
const scriptAttrs = {
|
|
17
|
+
src: script,
|
|
18
|
+
async,
|
|
19
|
+
defer
|
|
20
|
+
};
|
|
21
|
+
if (hostname) {
|
|
22
|
+
noScriptUrl += `?hostname=${hostname}`;
|
|
23
|
+
scriptAttrs["data-hostname"] = hostname;
|
|
24
|
+
}
|
|
25
|
+
const noscriptTemplate = `<img src="${noScriptUrl}" referrerpolicy="no-referrer-when-downgrade" alt="" />`;
|
|
26
|
+
tags.push({
|
|
27
|
+
tag: "script",
|
|
28
|
+
injectTo: "body",
|
|
29
|
+
attrs: scriptAttrs
|
|
30
|
+
});
|
|
31
|
+
tags.push({
|
|
32
|
+
tag: "noscript",
|
|
33
|
+
injectTo: "body-prepend",
|
|
34
|
+
children: noscriptTemplate
|
|
35
|
+
});
|
|
36
|
+
return tags;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
exports.default = injectTag;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
const defaults = {
|
|
2
|
+
script: "https://scripts.simpleanalyticscdn.com/latest.js",
|
|
3
|
+
noScript: "https://queue.simpleanalyticscdn.com/noscript.gif",
|
|
4
|
+
async: true,
|
|
5
|
+
defer: true
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
function injectTag(options) {
|
|
9
|
+
const tags = [];
|
|
10
|
+
if (!options.enabled)
|
|
11
|
+
return tags;
|
|
12
|
+
const { script, noScript, async, defer, hostname } = { ...defaults, ...options };
|
|
13
|
+
let noScriptUrl = noScript;
|
|
14
|
+
const scriptAttrs = {
|
|
15
|
+
src: script,
|
|
16
|
+
async,
|
|
17
|
+
defer
|
|
18
|
+
};
|
|
19
|
+
if (hostname) {
|
|
20
|
+
noScriptUrl += `?hostname=${hostname}`;
|
|
21
|
+
scriptAttrs["data-hostname"] = hostname;
|
|
22
|
+
}
|
|
23
|
+
const noscriptTemplate = `<img src="${noScriptUrl}" referrerpolicy="no-referrer-when-downgrade" alt="" />`;
|
|
24
|
+
tags.push({
|
|
25
|
+
tag: "script",
|
|
26
|
+
injectTo: "body",
|
|
27
|
+
attrs: scriptAttrs
|
|
28
|
+
});
|
|
29
|
+
tags.push({
|
|
30
|
+
tag: "noscript",
|
|
31
|
+
injectTo: "body-prepend",
|
|
32
|
+
children: noscriptTemplate
|
|
33
|
+
});
|
|
34
|
+
return tags;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export { injectTag as default };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const loader = `!function(t,e){var o,n,p,r;e.__SV||(window.posthog=e,e._i=[],e.init=function(i,s,a){function g(t,e){var o=e.split(".");2==o.length&&(t=t[o[0]],e=o[1]),t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}}(p=t.createElement("script")).type="text/javascript",p.crossOrigin="anonymous",p.async=!0,p.src=s.api_host.replace(".i.posthog.com","-assets.i.posthog.com")+"/static/array.js",(r=t.getElementsByTagName("script")[0]).parentNode.insertBefore(p,r);var u=e;for(void 0!==a?u=e[a]=[]:a="posthog",u.people=u.people||[],u.toString=function(t){var e="posthog";return"posthog"!==a&&(e+="."+a),t||(e+=" (stub)"),e},u.people.toString=function(){return u.toString(1)+".people (stub)"},o="init capture register register_once register_for_session unregister unregister_for_session getFeatureFlag getFeatureFlagPayload isFeatureEnabled reloadFeatureFlags updateEarlyAccessFeatureEnrollment getEarlyAccessFeatures on onFeatureFlags onSessionId getSurveys getActiveMatchingSurveys renderSurvey canRenderSurvey getNextSurveyStep identify setPersonProperties group resetGroups setPersonPropertiesForFlags resetPersonPropertiesForFlags setGroupPropertiesForFlags resetGroupPropertiesForFlags reset get_distinct_id getGroups get_session_id get_session_replay_url alias set_config startSessionRecording stopSessionRecording sessionRecordingStarted captureException loadToolbar get_property getSessionProperty createPersonProfile opt_in_capturing opt_out_capturing has_opted_in_capturing has_opted_out_capturing clear_opt_in_out_capturing debug".split(" "),n=0;n<o.length;n++)g(u,o[n]);e._i.push([i,s,a])},e.__SV=1)}(document,window.posthog||[]);`;
|
|
4
|
+
const defaults = {
|
|
5
|
+
loader
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
function injectTag(options) {
|
|
9
|
+
const tags = [];
|
|
10
|
+
if (!options.enabled)
|
|
11
|
+
return tags;
|
|
12
|
+
if (!options.token)
|
|
13
|
+
throw new Error("PostHog token is required");
|
|
14
|
+
if (!options.api_host)
|
|
15
|
+
throw new Error("PostHog API host is required");
|
|
16
|
+
const { loader } = { ...defaults, ...options };
|
|
17
|
+
tags.push({
|
|
18
|
+
tag: "script",
|
|
19
|
+
injectTo: "head",
|
|
20
|
+
children: `
|
|
21
|
+
${loader}
|
|
22
|
+
posthog.init('${options.token}', { api_host: '${options.api_host}', ...${options.config ? JSON.stringify(options.config) : "{}"} })
|
|
23
|
+
`
|
|
24
|
+
});
|
|
25
|
+
return tags;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
exports.default = injectTag;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const loader = `!function(t,e){var o,n,p,r;e.__SV||(window.posthog=e,e._i=[],e.init=function(i,s,a){function g(t,e){var o=e.split(".");2==o.length&&(t=t[o[0]],e=o[1]),t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}}(p=t.createElement("script")).type="text/javascript",p.crossOrigin="anonymous",p.async=!0,p.src=s.api_host.replace(".i.posthog.com","-assets.i.posthog.com")+"/static/array.js",(r=t.getElementsByTagName("script")[0]).parentNode.insertBefore(p,r);var u=e;for(void 0!==a?u=e[a]=[]:a="posthog",u.people=u.people||[],u.toString=function(t){var e="posthog";return"posthog"!==a&&(e+="."+a),t||(e+=" (stub)"),e},u.people.toString=function(){return u.toString(1)+".people (stub)"},o="init capture register register_once register_for_session unregister unregister_for_session getFeatureFlag getFeatureFlagPayload isFeatureEnabled reloadFeatureFlags updateEarlyAccessFeatureEnrollment getEarlyAccessFeatures on onFeatureFlags onSessionId getSurveys getActiveMatchingSurveys renderSurvey canRenderSurvey getNextSurveyStep identify setPersonProperties group resetGroups setPersonPropertiesForFlags resetPersonPropertiesForFlags setGroupPropertiesForFlags resetGroupPropertiesForFlags reset get_distinct_id getGroups get_session_id get_session_replay_url alias set_config startSessionRecording stopSessionRecording sessionRecordingStarted captureException loadToolbar get_property getSessionProperty createPersonProfile opt_in_capturing opt_out_capturing has_opted_in_capturing has_opted_out_capturing clear_opt_in_out_capturing debug".split(" "),n=0;n<o.length;n++)g(u,o[n]);e._i.push([i,s,a])},e.__SV=1)}(document,window.posthog||[]);`;
|
|
2
|
+
const defaults = {
|
|
3
|
+
loader
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
function injectTag(options) {
|
|
7
|
+
const tags = [];
|
|
8
|
+
if (!options.enabled)
|
|
9
|
+
return tags;
|
|
10
|
+
if (!options.token)
|
|
11
|
+
throw new Error("PostHog token is required");
|
|
12
|
+
if (!options.api_host)
|
|
13
|
+
throw new Error("PostHog API host is required");
|
|
14
|
+
const { loader } = { ...defaults, ...options };
|
|
15
|
+
tags.push({
|
|
16
|
+
tag: "script",
|
|
17
|
+
injectTo: "head",
|
|
18
|
+
children: `
|
|
19
|
+
${loader}
|
|
20
|
+
posthog.init('${options.token}', { api_host: '${options.api_host}', ...${options.config ? JSON.stringify(options.config) : "{}"} })
|
|
21
|
+
`
|
|
22
|
+
});
|
|
23
|
+
return tags;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { injectTag as default };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const defaults = {
|
|
4
|
+
script: "https://plausible.io/js/script.js",
|
|
5
|
+
defer: true
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
function injectTag(options) {
|
|
9
|
+
const tags = [];
|
|
10
|
+
if (!options.enabled)
|
|
11
|
+
return tags;
|
|
12
|
+
const { script, defer, hostname } = { ...defaults, ...options };
|
|
13
|
+
const scriptAttrs = {
|
|
14
|
+
src: script,
|
|
15
|
+
defer
|
|
16
|
+
};
|
|
17
|
+
if (hostname)
|
|
18
|
+
scriptAttrs["data-domain"] = hostname;
|
|
19
|
+
tags.push({
|
|
20
|
+
tag: "script",
|
|
21
|
+
injectTo: "head",
|
|
22
|
+
attrs: scriptAttrs
|
|
23
|
+
});
|
|
24
|
+
return tags;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
exports.default = injectTag;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const defaults = {
|
|
2
|
+
script: "https://plausible.io/js/script.js",
|
|
3
|
+
defer: true
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
function injectTag(options) {
|
|
7
|
+
const tags = [];
|
|
8
|
+
if (!options.enabled)
|
|
9
|
+
return tags;
|
|
10
|
+
const { script, defer, hostname } = { ...defaults, ...options };
|
|
11
|
+
const scriptAttrs = {
|
|
12
|
+
src: script,
|
|
13
|
+
defer
|
|
14
|
+
};
|
|
15
|
+
if (hostname)
|
|
16
|
+
scriptAttrs["data-domain"] = hostname;
|
|
17
|
+
tags.push({
|
|
18
|
+
tag: "script",
|
|
19
|
+
injectTo: "head",
|
|
20
|
+
attrs: scriptAttrs
|
|
21
|
+
});
|
|
22
|
+
return tags;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { injectTag as default };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const defaults = {
|
|
4
|
+
gtmBase: "https://www.googletagmanager.com/gtm.js",
|
|
5
|
+
nsBase: "https://www.googletagmanager.com/ns.html",
|
|
6
|
+
async: true,
|
|
7
|
+
loader: "window.dataLayer = window.dataLayer || [];\nwindow.dataLayer.push({'gtm.start': new Date().getTime(),event:'gtm.js'});\n"
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
function injectTag(options) {
|
|
11
|
+
const tags = [];
|
|
12
|
+
const properties = (Array.isArray(options) ? options : [options]).map((property) => ({ ...defaults, ...property })).filter((property) => Boolean(property.id));
|
|
13
|
+
if (!properties.length)
|
|
14
|
+
return tags;
|
|
15
|
+
let template = "";
|
|
16
|
+
template += properties[0].loader;
|
|
17
|
+
tags.push({
|
|
18
|
+
tag: "script",
|
|
19
|
+
children: template
|
|
20
|
+
});
|
|
21
|
+
for (const property of properties) {
|
|
22
|
+
const environmentAttachment = property.environment ? `>m_auth=${property.environment.auth}>m_preview=${property.environment.preview}` : "";
|
|
23
|
+
tags.push({
|
|
24
|
+
tag: "script",
|
|
25
|
+
attrs: {
|
|
26
|
+
src: `${property.gtmBase}?id=${property.id}${environmentAttachment}`,
|
|
27
|
+
async: property.async
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
tags.push({
|
|
31
|
+
tag: "noscript",
|
|
32
|
+
injectTo: "body-prepend",
|
|
33
|
+
children: `<iframe src="${property.nsBase}?id=${property.id}${environmentAttachment}" height="0" width="0" style="display:none;visibility:hidden"></iframe>`
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
return tags;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
exports.default = injectTag;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
const defaults = {
|
|
2
|
+
gtmBase: "https://www.googletagmanager.com/gtm.js",
|
|
3
|
+
nsBase: "https://www.googletagmanager.com/ns.html",
|
|
4
|
+
async: true,
|
|
5
|
+
loader: "window.dataLayer = window.dataLayer || [];\nwindow.dataLayer.push({'gtm.start': new Date().getTime(),event:'gtm.js'});\n"
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
function injectTag(options) {
|
|
9
|
+
const tags = [];
|
|
10
|
+
const properties = (Array.isArray(options) ? options : [options]).map((property) => ({ ...defaults, ...property })).filter((property) => Boolean(property.id));
|
|
11
|
+
if (!properties.length)
|
|
12
|
+
return tags;
|
|
13
|
+
let template = "";
|
|
14
|
+
template += properties[0].loader;
|
|
15
|
+
tags.push({
|
|
16
|
+
tag: "script",
|
|
17
|
+
children: template
|
|
18
|
+
});
|
|
19
|
+
for (const property of properties) {
|
|
20
|
+
const environmentAttachment = property.environment ? `>m_auth=${property.environment.auth}>m_preview=${property.environment.preview}` : "";
|
|
21
|
+
tags.push({
|
|
22
|
+
tag: "script",
|
|
23
|
+
attrs: {
|
|
24
|
+
src: `${property.gtmBase}?id=${property.id}${environmentAttachment}`,
|
|
25
|
+
async: property.async
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
tags.push({
|
|
29
|
+
tag: "noscript",
|
|
30
|
+
injectTo: "body-prepend",
|
|
31
|
+
children: `<iframe src="${property.nsBase}?id=${property.id}${environmentAttachment}" height="0" width="0" style="display:none;visibility:hidden"></iframe>`
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
return tags;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export { injectTag as default };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const defaults = {
|
|
4
|
+
script: "https://connect.facebook.net/en_US/fbevents.js",
|
|
5
|
+
noScript: "https://www.facebook.com/tr",
|
|
6
|
+
event: "PageView"
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
function injectTag(options) {
|
|
10
|
+
const tags = [];
|
|
11
|
+
const properties = (Array.isArray(options) ? options : [options]).filter((property) => Boolean(property.id)).map((property) => ({ ...defaults, ...property }));
|
|
12
|
+
if (!properties.length)
|
|
13
|
+
return tags;
|
|
14
|
+
const [{ script, event }] = properties;
|
|
15
|
+
let template = "";
|
|
16
|
+
let noscriptTemplate = "";
|
|
17
|
+
template += "!function(f,b,e,v,n,t,s)";
|
|
18
|
+
template += "{if(f.fbq)return;n=f.fbq=function(){n.callMethod?";
|
|
19
|
+
template += "n.callMethod.apply(n,arguments):n.queue.push(arguments)};";
|
|
20
|
+
template += "if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';";
|
|
21
|
+
template += "n.queue=[];t=b.createElement(e);t.async=!0;";
|
|
22
|
+
template += "t.src=v;s=b.getElementsByTagName(e)[0];";
|
|
23
|
+
template += "s.parentNode.insertBefore(t,s)}(window, document,'script',";
|
|
24
|
+
template += `'${script}');`;
|
|
25
|
+
for (const property of properties) {
|
|
26
|
+
template += `fbq('init', '${property.id}');`;
|
|
27
|
+
noscriptTemplate += `<img height="1" width="1" style="display:none" src="${property.noScript}?id=${property.id}&ev=PageView&noscript=1"/>
|
|
28
|
+
`;
|
|
29
|
+
}
|
|
30
|
+
template += `fbq('track', '${event}');`;
|
|
31
|
+
tags.push({
|
|
32
|
+
tag: "script",
|
|
33
|
+
children: template
|
|
34
|
+
});
|
|
35
|
+
tags.push({
|
|
36
|
+
tag: "noscript",
|
|
37
|
+
injectTo: "body-prepend",
|
|
38
|
+
children: noscriptTemplate
|
|
39
|
+
});
|
|
40
|
+
return tags;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
exports.default = injectTag;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const defaults = {
|
|
2
|
+
script: "https://connect.facebook.net/en_US/fbevents.js",
|
|
3
|
+
noScript: "https://www.facebook.com/tr",
|
|
4
|
+
event: "PageView"
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
function injectTag(options) {
|
|
8
|
+
const tags = [];
|
|
9
|
+
const properties = (Array.isArray(options) ? options : [options]).filter((property) => Boolean(property.id)).map((property) => ({ ...defaults, ...property }));
|
|
10
|
+
if (!properties.length)
|
|
11
|
+
return tags;
|
|
12
|
+
const [{ script, event }] = properties;
|
|
13
|
+
let template = "";
|
|
14
|
+
let noscriptTemplate = "";
|
|
15
|
+
template += "!function(f,b,e,v,n,t,s)";
|
|
16
|
+
template += "{if(f.fbq)return;n=f.fbq=function(){n.callMethod?";
|
|
17
|
+
template += "n.callMethod.apply(n,arguments):n.queue.push(arguments)};";
|
|
18
|
+
template += "if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';";
|
|
19
|
+
template += "n.queue=[];t=b.createElement(e);t.async=!0;";
|
|
20
|
+
template += "t.src=v;s=b.getElementsByTagName(e)[0];";
|
|
21
|
+
template += "s.parentNode.insertBefore(t,s)}(window, document,'script',";
|
|
22
|
+
template += `'${script}');`;
|
|
23
|
+
for (const property of properties) {
|
|
24
|
+
template += `fbq('init', '${property.id}');`;
|
|
25
|
+
noscriptTemplate += `<img height="1" width="1" style="display:none" src="${property.noScript}?id=${property.id}&ev=PageView&noscript=1"/>
|
|
26
|
+
`;
|
|
27
|
+
}
|
|
28
|
+
template += `fbq('track', '${event}');`;
|
|
29
|
+
tags.push({
|
|
30
|
+
tag: "script",
|
|
31
|
+
children: template
|
|
32
|
+
});
|
|
33
|
+
tags.push({
|
|
34
|
+
tag: "noscript",
|
|
35
|
+
injectTo: "body-prepend",
|
|
36
|
+
children: noscriptTemplate
|
|
37
|
+
});
|
|
38
|
+
return tags;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { injectTag as default };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const defaults = {
|
|
4
|
+
script: "https://vk.com/js/api/openapi.js?169",
|
|
5
|
+
noScript: "https://vk.com/rtrg",
|
|
6
|
+
hit: "VK.Retargeting.Hit()"
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
function injectTag(options) {
|
|
10
|
+
const tags = [];
|
|
11
|
+
const properties = (Array.isArray(options) ? options : [options]).filter((property) => Boolean(property.id)).map((property) => ({ ...defaults, ...property }));
|
|
12
|
+
if (!properties.length)
|
|
13
|
+
return tags;
|
|
14
|
+
const [{ script, hit }] = properties;
|
|
15
|
+
let template = "";
|
|
16
|
+
let noscriptTemplate = "";
|
|
17
|
+
template += "!(function()";
|
|
18
|
+
template += '{var t=document.createElement("script");t.type="text/javascript",';
|
|
19
|
+
template += `t.async=!0,t.src="${script}",t.onload=function(){`;
|
|
20
|
+
for (const property of properties) {
|
|
21
|
+
template += `VK.Retargeting.Init("${property.id}"),`;
|
|
22
|
+
noscriptTemplate += `<img height="1" width="1" style="display:none" src="${property.noScript}?p=${property.id}"/>
|
|
23
|
+
`;
|
|
24
|
+
}
|
|
25
|
+
template += `${hit}},document.head.appendChild(t);})();`;
|
|
26
|
+
tags.push({
|
|
27
|
+
tag: "script",
|
|
28
|
+
children: template
|
|
29
|
+
});
|
|
30
|
+
tags.push({
|
|
31
|
+
tag: "noscript",
|
|
32
|
+
injectTo: "body-prepend",
|
|
33
|
+
children: noscriptTemplate
|
|
34
|
+
});
|
|
35
|
+
return tags;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
exports.default = injectTag;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const defaults = {
|
|
2
|
+
script: "https://vk.com/js/api/openapi.js?169",
|
|
3
|
+
noScript: "https://vk.com/rtrg",
|
|
4
|
+
hit: "VK.Retargeting.Hit()"
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
function injectTag(options) {
|
|
8
|
+
const tags = [];
|
|
9
|
+
const properties = (Array.isArray(options) ? options : [options]).filter((property) => Boolean(property.id)).map((property) => ({ ...defaults, ...property }));
|
|
10
|
+
if (!properties.length)
|
|
11
|
+
return tags;
|
|
12
|
+
const [{ script, hit }] = properties;
|
|
13
|
+
let template = "";
|
|
14
|
+
let noscriptTemplate = "";
|
|
15
|
+
template += "!(function()";
|
|
16
|
+
template += '{var t=document.createElement("script");t.type="text/javascript",';
|
|
17
|
+
template += `t.async=!0,t.src="${script}",t.onload=function(){`;
|
|
18
|
+
for (const property of properties) {
|
|
19
|
+
template += `VK.Retargeting.Init("${property.id}"),`;
|
|
20
|
+
noscriptTemplate += `<img height="1" width="1" style="display:none" src="${property.noScript}?p=${property.id}"/>
|
|
21
|
+
`;
|
|
22
|
+
}
|
|
23
|
+
template += `${hit}},document.head.appendChild(t);})();`;
|
|
24
|
+
tags.push({
|
|
25
|
+
tag: "script",
|
|
26
|
+
children: template
|
|
27
|
+
});
|
|
28
|
+
tags.push({
|
|
29
|
+
tag: "noscript",
|
|
30
|
+
injectTo: "body-prepend",
|
|
31
|
+
children: noscriptTemplate
|
|
32
|
+
});
|
|
33
|
+
return tags;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export { injectTag as default };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const defaults = {
|
|
4
|
+
script: "https://hm.baidu.com/hm.js",
|
|
5
|
+
async: true,
|
|
6
|
+
autoPageview: true
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
function injectTag(options) {
|
|
10
|
+
const tags = [];
|
|
11
|
+
const properties = (Array.isArray(options) ? options : [options]).filter((property) => Boolean(property.id)).map((property) => ({ ...defaults, ...property }));
|
|
12
|
+
if (!properties.length)
|
|
13
|
+
return tags;
|
|
14
|
+
let template = "";
|
|
15
|
+
template += "var _hmt = _hmt || [];\n";
|
|
16
|
+
template += `_hmt.push(['_setAutoPageview', ${properties[0].autoPageview}]);
|
|
17
|
+
`;
|
|
18
|
+
for (const property of properties)
|
|
19
|
+
template += `_hmt.push(['_setAccount', '${property.id}']);
|
|
20
|
+
`;
|
|
21
|
+
tags.push({
|
|
22
|
+
tag: "script",
|
|
23
|
+
children: template
|
|
24
|
+
});
|
|
25
|
+
for (const property of properties) {
|
|
26
|
+
tags.push({
|
|
27
|
+
tag: "script",
|
|
28
|
+
attrs: {
|
|
29
|
+
src: `${property.script}?${property.id}`,
|
|
30
|
+
async: property.async
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
return tags;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
exports.default = injectTag;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const defaults = {
|
|
2
|
+
script: "https://hm.baidu.com/hm.js",
|
|
3
|
+
async: true,
|
|
4
|
+
autoPageview: true
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
function injectTag(options) {
|
|
8
|
+
const tags = [];
|
|
9
|
+
const properties = (Array.isArray(options) ? options : [options]).filter((property) => Boolean(property.id)).map((property) => ({ ...defaults, ...property }));
|
|
10
|
+
if (!properties.length)
|
|
11
|
+
return tags;
|
|
12
|
+
let template = "";
|
|
13
|
+
template += "var _hmt = _hmt || [];\n";
|
|
14
|
+
template += `_hmt.push(['_setAutoPageview', ${properties[0].autoPageview}]);
|
|
15
|
+
`;
|
|
16
|
+
for (const property of properties)
|
|
17
|
+
template += `_hmt.push(['_setAccount', '${property.id}']);
|
|
18
|
+
`;
|
|
19
|
+
tags.push({
|
|
20
|
+
tag: "script",
|
|
21
|
+
children: template
|
|
22
|
+
});
|
|
23
|
+
for (const property of properties) {
|
|
24
|
+
tags.push({
|
|
25
|
+
tag: "script",
|
|
26
|
+
attrs: {
|
|
27
|
+
src: `${property.script}?${property.id}`,
|
|
28
|
+
async: property.async
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
return tags;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { injectTag as default };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const defaults = {
|
|
4
|
+
script: "https://snap.licdn.com/li.lms-analytics/insight.min.js",
|
|
5
|
+
noScript: "https://px.ads.linkedin.com/collect/",
|
|
6
|
+
async: true
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
function injectTag(options) {
|
|
10
|
+
const tags = [];
|
|
11
|
+
const properties = (Array.isArray(options) ? options : [options]).filter((property) => Boolean(property.id)).map((property) => ({ ...defaults, ...property }));
|
|
12
|
+
if (!properties.length)
|
|
13
|
+
return tags;
|
|
14
|
+
let template = "";
|
|
15
|
+
let noscriptTemplate = "";
|
|
16
|
+
template += "window._linkedin_data_partner_ids = window._linkedin_data_partner_ids || [];\n";
|
|
17
|
+
for (const property of properties) {
|
|
18
|
+
template += `window._linkedin_data_partner_ids.push(${property.id});
|
|
19
|
+
`;
|
|
20
|
+
noscriptTemplate += `<img height="1" width="1" style="display:none;" alt="" src="${property.noScript}?pid=${property.id}&fmt=gif" />`;
|
|
21
|
+
}
|
|
22
|
+
const [{ script, async }] = properties;
|
|
23
|
+
tags.push({
|
|
24
|
+
tag: "script",
|
|
25
|
+
children: template
|
|
26
|
+
});
|
|
27
|
+
tags.push({
|
|
28
|
+
tag: "script",
|
|
29
|
+
attrs: {
|
|
30
|
+
src: `${script}`,
|
|
31
|
+
async
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
tags.push({
|
|
35
|
+
tag: "noscript",
|
|
36
|
+
injectTo: "body-prepend",
|
|
37
|
+
children: noscriptTemplate
|
|
38
|
+
});
|
|
39
|
+
return tags;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
exports.default = injectTag;
|