//------------------------------
//--------------------
// add this before event code to all pages where PII data postback is expected and appropriate
ttq.identify({
"email": "", // string. The email of the customer if available. It must be hashed with SHA-256 on the client side.
"phone_number": "", // string. The phone number of the customer if available. It must be hashed with SHA-256 on the client side.
"external_id": "" // string. Any unique identifier, such as loyalty membership IDs, user IDs, and external cookie IDs.It must be hashed with SHA-256 on the client side.
});
ttq.track('ViewContent', {
"contents": [
{
"content_id": "", // string. ID of the product. Example: "1077218".
"content_type": "", // string. Either product or product_group.
"content_name": "" // string. The name of the page or product. Example: "shirt".
}
],
"value": "", // number. Value of the order or items sold. Example: 100.
"currency": "" // string. The 4217 currency code. Example: "USD".
});
ttq.track('AddToCart', {
"contents": [
{
"content_id": "", // string. ID of the product. Example: "1077218".
"content_type": "", // string. Either product or product_group.
"content_name": "" // string. The name of the page or product. Example: "shirt".
}
],
"value": "", // number. Value of the order or items sold. Example: 100.
"currency": "" // string. The 4217 currency code. Example: "USD".
});
ttq.track('CompletePayment', {
"contents": [
{
"content_id": "", // string. ID of the product. Example: "1077218".
"content_type": "", // string. Either product or product_group.
"content_name": "" // string. The name of the page or product. Example: "shirt".
}
],
"value": "", // number. Value of the order or items sold. Example: 100.
"currency": "" // string. The 4217 currency code. Example: "USD".
});
//--------------------------------
// Snap Pixel Code
(function(e,t,n){if(e.snaptr)return;var a=e.snaptr=function()
{a.handleRequest?a.handleRequest.apply(a,arguments):a.queue.push(arguments)};
a.queue=[];var s='script';r=t.createElement(s);r.async=!0;
r.src=n;var u=t.getElementsByTagName(s)[0];
u.parentNode.insertBefore(r,u);})(window,document,
'https://sc-static.net/scevent.min.js');
snaptr('init', '9e061ec6-df73-451f-941a-e93428831e5e', {});
snaptr('track', 'PAGE_VIEW');
// End Snap Pixel Code
//------------------------------
var isAppleDevice = /iPhone|iPad|iPod|Macintosh|MacIntel|MacPPC|Mac68K/.test(navigator.platform)
|| /iPhone|iPad|iPod/.test(navigator.userAgent);
// إذا كان الجهاز آبل، إخفاء رابط متجر Google Play
if (isAppleDevice) {
// استهداف الرابط الخاص بـ Google Play عن طريق alt الخاص بالصورة أو بأي خاصية يمكن استهدافها
var googlePlayLink = document.querySelector('a[href*="play.google.com"]');
if (googlePlayLink) {
googlePlayLink.style.display = 'none'; // إخفاء الرابط
}
}
//------------------------------
document.addEventListener("DOMContentLoaded", function () {
// التحقق من أن الجهاز يعمل بنظام Android
const isAndroid = /android/i.test(navigator.userAgent);
// إذا كان الجهاز Android، أخفِ العنصر الخاص برابط iOS
if (isAndroid) {
const iosLink = document.querySelector('a[aria-label="link"] img[alt="appstore"]');
if (iosLink) {
iosLink.closest('a').style.display = 'none';
}
}
});
//------------------------------
document.addEventListener("DOMContentLoaded", function () {
// التحقق مما إذا كان المستخدم يدخل من خلال WebView (أندرويد أو iOS)
const isInWebView = () => {
const userAgent = navigator.userAgent.toLowerCase();
// التحقق من أندرويد WebView
const isAndroidWebView = userAgent.includes('wv');
// التحقق من iOS WebView أو PWA
const isIOS = /iphone|ipad|ipod/.test(userAgent);
const isIOSWebView = isIOS && !window.navigator.standalone;
return isAndroidWebView || isIOSWebView;
};
// إذا كان المستخدم يدخل من خلال التطبيق (WebView)، لا تعرض النافذة
if (!isInWebView()) {
// التحقق مما إذا كانت الرسالة قد ظهرت أثناء هذه الجلسة
const popupShown = sessionStorage.getItem('popupShown');
if (!popupShown) {
setTimeout(function () {
// إنشاء عناصر النافذة إذا لم تكن موجودة
if (!document.getElementById('popup')) {
const popup = document.createElement('div');
popup.id = 'popup';
popup.style.cssText = `
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 90%;
max-width: 400px;
background: white;
padding: 20px;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
z-index: 1000;
text-align: center;
`;
popup.innerHTML = `
🌟 حمل الآن تطبيق بسطة مارت! 🌟
تسوقوا بسهولة وسرعة مع تطبيق بسطة مارت واحصلوا على أفضل العروض على الخضار والفواكه الطازجة!
✅ تسوقوا الآن واستمتعوا بتجربة سهلة وسريعة مع تطبيق بسطة مارت!
`;
document.body.appendChild(popup);
const overlay = document.createElement('div');
overlay.id = 'overlay';
overlay.style.cssText = `
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.5);
z-index: 999;
`;
document.body.appendChild(overlay);
}
// عرض النافذة والخلفية
document.getElementById('popup').style.display = 'block';
document.getElementById('overlay').style.display = 'block';
// تخزين معلومات العرض في Session Storage
sessionStorage.setItem('popupShown', 'true');
setTimeout(closePopup, 90000); // 90,000 ميلي ثانية = 90 ثانية
}, 3000); // وقت الانتظار (3 ثوانٍ)
}
}
});
// وظيفة إغلاق النافذة
function closePopup() {
document.getElementById('popup').style.display = 'none';
document.getElementById('overlay').style.display = 'none';
}