Skip to content

Commit

Permalink
Merge pull request #172 from moiz-deriv/moiz/remove-track-ignore
Browse files Browse the repository at this point in the history
fix: removed trackjs ignore
  • Loading branch information
moiz-deriv authored Oct 10, 2024
2 parents 7d4e0a7 + 341bb5a commit 3e3094f
Showing 1 changed file with 19 additions and 23 deletions.
42 changes: 19 additions & 23 deletions src/js/footer/clientsCountryCookie/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,27 @@ import populateFooterComponent from "../footerComponent";
document.addEventListener("DOMContentLoaded", function () {
const message = JSON.stringify({ website_status: 1 });
const messageType = "website_status";
TrackJS.ignore(() => {
async function fetchCountryAndPopulateFooter() {
try {
const response = await fetch(
"https://www.cloudflare.com/cdn-cgi/trace"
);
const text = await response.text();
const CloudflareCountry = Object.fromEntries(
text.split("\n").map((v) => v.split("=", 2))
).loc.toLowerCase();
const clientsCountryFromCookie = getCookieByKey(
document.cookie,
"clients_country"
);
if (CloudflareCountry !== clientsCountryFromCookie) {
deleteCookie("clients_country");
setCookie("clients_country", CloudflareCountry, 30);
}
populateFooterComponent();
} catch (error) {
console.error("Error:", error);
populateFooterComponent();
async function fetchCountryAndPopulateFooter() {
try {
const response = await fetch("https://www.cloudflare.com/cdn-cgi/trace");
const text = await response.text();
const CloudflareCountry = Object.fromEntries(
text.split("\n").map((v) => v.split("=", 2))
).loc.toLowerCase();
const clientsCountryFromCookie = getCookieByKey(
document.cookie,
"clients_country"
);
if (CloudflareCountry !== clientsCountryFromCookie) {
deleteCookie("clients_country");
setCookie("clients_country", CloudflareCountry, 30);
}
populateFooterComponent();
} catch (error) {
console.error("Error:", error);
populateFooterComponent();
}
});
}
fetchCountryAndPopulateFooter();
const clientsCountryFromCookie = getCookieByKey(
document.cookie,
Expand Down

0 comments on commit 3e3094f

Please sign in to comment.