Skip to content

Commit 3f18131

Browse files
committed
Update base.js
1 parent 05bb6f8 commit 3f18131

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

packages/script/src/base.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,13 @@
146146
let clientClickTracked = false;
147147

148148
// Track click and set cookie
149-
function trackClick({ domain, key }, serverClickId) {
149+
function trackClick({ domain, key }) {
150150
if (clientClickTracked) return;
151151
clientClickTracked = true;
152152

153+
const params = new URLSearchParams(location.search);
154+
const serverClickId = params.get(DUB_ID_VAR);
155+
153156
fetch(`${API_HOST}/track/click`, {
154157
method: 'POST',
155158
headers: { 'Content-Type': 'application/json' },
@@ -215,13 +218,10 @@
215218

216219
// Dub Partners tracking (via query param e.g. ?via=partner_id)
217220
if (QUERY_PARAM_VALUE && SHORT_DOMAIN && shouldSetCookie()) {
218-
trackClick(
219-
{
220-
domain: SHORT_DOMAIN,
221-
key: QUERY_PARAM_VALUE,
222-
},
223-
clickId,
224-
);
221+
trackClick({
222+
domain: SHORT_DOMAIN,
223+
key: QUERY_PARAM_VALUE,
224+
});
225225
}
226226

227227
// Process the queued methods

0 commit comments

Comments
 (0)