Closed tonysaad closed 2 years ago
Hi! ๐
Firstly, thanks for your work on this project! ๐
Today I used patch-package to patch plausible-tracker@0.3.5 for the project I'm working on.
plausible-tracker@0.3.5
Here is the diff that solved my problem:
diff --git a/node_modules/plausible-tracker/.DS_Store b/node_modules/plausible-tracker/.DS_Store new file mode 100644 index 0000000..5172429 Binary files /dev/null and b/node_modules/plausible-tracker/.DS_Store differ diff --git a/node_modules/plausible-tracker/src/lib/request.ts b/node_modules/plausible-tracker/src/lib/request.ts index 8867bce..898c552 100644 --- a/node_modules/plausible-tracker/src/lib/request.ts +++ b/node_modules/plausible-tracker/src/lib/request.ts @@ -67,7 +67,7 @@ export function sendEvent( }; const req = new XMLHttpRequest(); - req.open('POST', `${data.apiHost}/api/event`, true); + req.open('POST', `${data.apiHost.includes('plausible.io') ? `${data.apiHost}/api/event` : data.apiHost}`, true); req.setRequestHeader('Content-Type', 'text/plain'); req.send(JSON.stringify(payload)); // eslint-disable-next-line functional/immutable-data
This issue body was partially generated by patch-package.
Hi, consider creating a pull request for this if the code you posted works. This will speed up the merging of this.
Hi! ๐
Firstly, thanks for your work on this project! ๐
Today I used patch-package to patch
plausible-tracker@0.3.5
for the project I'm working on.Here is the diff that solved my problem:
This issue body was partially generated by patch-package.