Skip to content

Commit

Permalink
Merge pull request #7 from shakeraft/main
Browse files Browse the repository at this point in the history
Add custom domain support in the noscript tag
  • Loading branch information
IPQualityScore committed Dec 13, 2023
2 parents 48b77c0 + a6f4e5d commit d071ef1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/util/domManipulation.ts
Expand Up @@ -10,7 +10,7 @@ export const addDeviceTrackingTags = (
) => {
document.head.appendChild(getScriptTagWindowIPQInit());
document.head.appendChild(getScriptTagLoadSrc(secretKey, tracker, domain));
document.head.appendChild(getNoscriptTag(secretKey, tracker));
document.head.appendChild(getNoscriptTag(secretKey, tracker, domain));
};

export const addDeviceTrackingTagsAsync = (
Expand All @@ -23,7 +23,7 @@ export const addDeviceTrackingTagsAsync = (
document.head.appendChild(
getScriptTagLoadSrcAsync(secretKey, tracker, domain, resolve, reject)
);
document.head.appendChild(getNoscriptTag(secretKey, tracker));
document.head.appendChild(getNoscriptTag(secretKey, tracker, domain));
});
};

Expand Down Expand Up @@ -74,15 +74,15 @@ const getScriptTagLoadSrcAsync = (
return scriptTag;
};

const getNoscriptTag = (secretKey: string, domain: string) => {
const getNoscriptTag = (secretKey: string, tracker: string, domain: string) => {
const noscriptTag: Element = document.createElement("noscript");
noscriptTag.appendChild(generateImageTag(secretKey, domain));
noscriptTag.appendChild(generateImageTag(secretKey, tracker, domain));
return noscriptTag;
};

const generateImageTag = (secretKey: string, domain: string) => {
const generateImageTag = (secretKey: string, tracker: string, domain: string) => {
const imageTag: Element = document.createElement("img");
const srcImage = `https://www.ipqscdn.com/api/${domain}/${secretKey}/pixel.png`;
const srcImage = `https://${domain}/api/${tracker}/${secretKey}/pixel.png`;
imageTag.setAttribute("src", srcImage);
return imageTag;
};
Expand Down

0 comments on commit d071ef1

Please sign in to comment.