Hello, everyone!

Our product is designed to facilitate sales tracking on Google Ads for 
products from platforms like Clickbank, Buygoods, among others.

Our product is aimed at affiliates who use Google Ads as a platform for 
product advertising.

In practice, our users install our custom-generated code snippet on their 
landing pages, and through this snippet, we collect important information 
about the buyers and visitors of the ad.

Thus, we can generate detailed reports to enable the optimization of 
campaigns.

It happens that some of our users have reported having their accounts 
suspended after using our product.

I would like to know if there is any connection between the suspended 
accounts and our snippet.

Below, I insert the snippet code:

let filtripixel_trackingId = 0;
let filtripixel_pixelId = '';
let filtripixel_interactionEnabled = false;
let filtripixel_lastScrollPosition = 0;
let filtripixel_lastReportedScrollPercentage = 0;
let filtripixel_verify_installation = false;

function filtripixel_preventInteraction(event) {
if (!filtripixel_interactionEnabled) {
event.preventDefault();
event.stopPropagation();
}
}

function filtripixel_getTrackingId(params) {
const body = {
events: [
{
type: 'visit',
...params,
},
],
pixelId: filtripixel_pixelId,
};
const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(body),
};

fetch('https://filtripixel.io', options)
.then((response) => response.json())
.then((response) => {
filtripixel_trackingId = response.trackingId;
filtripixel_setTrackingIdOnAllLinks(response.trackingId);
})
.catch((err) => {
filtripixel_interactionEnabled = true;
document.removeEventListener('click', filtripixel_preventInteraction, true);
});
}

function filtripixel_sendEvents(params, eventType) {
const body = {
trackingId: filtripixel_trackingId,
pixelId: filtripixel_pixelId,
events: [
{
type: eventType,
...params,
},
],
};
const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(body),
};

fetch('https://filtripixel.io', options).catch((err) => {
filtripixel_interactionEnabled = true;
document.removeEventListener('click', filtripixel_preventInteraction, true);
});
}

function filtripixel_getParamsFromQueryString() {
const currentUrl = new URL(window.location.href);
const params = new URLSearchParams(currentUrl.search);
const visitParameters = {};

params.forEach((value, key) => {
visitParameters[key] = value;
if (key === 'filtripixel-installation-verify') {
if (value === filtripixel_pixelId) {
alert('Filtripixel instalado com sucesso');
}
}
});
filtripixel_getTrackingId(visitParameters);
}

function filtripixel_setTrackingIdOnAllLinks(trackingId) {
const links = document.querySelectorAll('a');
links.forEach((link) => {
if (link.href) {
try {
const linkUrl = new URL(link.href);
const params = ['tid', 'subid', 'sid1', 'sck', 'src'];
params.forEach((param) => {
linkUrl.searchParams.set(param, trackingId);
});
link.href = linkUrl.href;
filtripixel_interactionEnabled = true;
document.removeEventListener('click', filtripixel_preventInteraction, true);
const readyDiv = document.createElement('div');
readyDiv.id = 'filtripixel_is_ready';
readyDiv.style.display = 'none';
document.body.appendChild(readyDiv);
} catch (error) {
console.error(error);
}
}
});
}

function filtripixel_calculateScrollPercentage() {
const scrolled = window.scrollY;
const viewportHeight = window.innerHeight;
const fullHeight = document.documentElement.scrollHeight;
const scrolledPercentage = Math.min(((scrolled + viewportHeight) / 
fullHeight) * 100, 100);
return scrolledPercentage;
}

function filtripixel_handleScrollEvent() {
const currentScrollPosition = window.scrollY;
const currentScrollPercentage = filtripixel_calculateScrollPercentage();

const scrollDirection =
currentScrollPosition > filtripixel_lastScrollPosition ? 'scroll-down' : 
'scroll-up';

const reportingThreshold = 10;
if (
Math.abs(currentScrollPercentage - filtripixel_lastReportedScrollPercentage) 
>=
reportingThreshold
) {
filtripixel_sendEvents({ percentage: Math.round(currentScrollPercentage) }, 
scrollDirection);

filtripixel_lastReportedScrollPercentage = currentScrollPercentage;
}

filtripixel_lastScrollPosition = currentScrollPosition;
}

function filtripixel() {
filtripixel_getParamsFromQueryString();
document.addEventListener('click', function (event) {
let target = event.target;

while (target && target !== document.body && target.nodeName !== 'A') {
target = target.parentNode;
}

if (target && target.nodeName === 'A') {
const params = Array.from(target.attributes).reduce((acc, attr) => {
acc[attr.name] = attr.value;
return acc;
}, {});
filtripixel_sendEvents(params, 'click');
}
});
window.addEventListener('scroll', filtripixel_handleScrollEvent);
}

document.addEventListener('DOMContentLoaded', function () {
document.addEventListener('click', filtripixel_preventInteraction, true);
const scriptTags = document.getElementsByTagName('script');
for (let script of scriptTags) {
if (script.src.includes('filtripixel.minify.js')) {
const url = new URL(script.src);
filtripixel_pixelId = url.searchParams.get('pixelId');
if (filtripixel_pixelId) {
filtripixel();
break;
}
}
}
});

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/6c5ddfdf-6593-496d-ad13-fb99e9375f5cn%40googlegroups.com.

Reply via email to