Skip to content

Commit 0c2b640

Browse files
committed
typo fix
fix for jitsuProps replace code
1 parent 13c715b commit 0c2b640

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

documentation/sending-data/js-sdk/parameters-reference.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,15 @@ EventNative accepts the following parameters.
155155
<a href="/docs/sending-data/privacy-mode">Privacy Mode</a>
156156
</td>
157157
</tr>
158+
<tr>
159+
<td>
160+
force_use_fetch
161+
<br />(<span style={{ whiteSpace: "nowrap" }}>data-force-use-fetch</span>)
162+
</td>
163+
<td>
164+
This parameter forces SDK to use the fetch implementation (custom or default) even in browser
165+
</td>
166+
</tr>
158167
<tr>
159168
<td>
160169
custom_headers

javascript-sdk/src/browser.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ const jsFileName = "lib.js"
77
const jitsuProps = [
88
'use_beacon_api', 'cookie_domain', 'tracking_host', 'cookie_name',
99
'key', 'ga_hook', 'segment_hook', 'randomize_url', 'capture_3rd_party_cookies',
10-
'id_method', 'log_level', 'compat_mode','privacy_policy', 'cookie_policy', 'ip_policy', 'custom_headers'
10+
'id_method', 'log_level', 'compat_mode','privacy_policy', 'cookie_policy', 'ip_policy', 'custom_headers',
11+
'force_use_fetch'
1112
];
1213

1314

@@ -42,7 +43,7 @@ function getTracker(window): JitsuClient {
4243
};
4344

4445
jitsuProps.forEach(prop => {
45-
let attr = "data-" + prop.replace("_", "-");
46+
let attr = "data-" + prop.replace(new RegExp("_", "g"), "-");
4647
if (script.getAttribute(attr) !== undefined && script.getAttribute(attr) !== null) {
4748
let val: any = script.getAttribute(attr);
4849
if ("true" === val) {

javascript-sdk/src/interface.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ export type JitsuOptions = {
106106
/**
107107
* Forces Jitsu SDK to use the fetch implementation (custom or default) even in browser
108108
*/
109-
forceUseFetch?: any,
109+
force_use_fetch?: any,
110110

111111
/**
112112
* If Jitsu should work in compatibility mode. If set to true:

javascript-sdk/src/jitsu.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ class JitsuClientImpl implements JitsuClient {
642642
}
643643

644644
init(options: JitsuOptions) {
645-
if (isWindowAvailable() && !options.forceUseFetch) {
645+
if (isWindowAvailable() && !options.force_use_fetch) {
646646
if (options.fetch) {
647647
getLogger().warn(
648648
"Custom fetch implementation is provided to Jitsu. However, it will be ignored since Jitsu runs in browser"

0 commit comments

Comments
 (0)