קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
בוחרים את הפלטפורמה:
Measurement Protocol של Google Analytics לא מחזיר קודי שגיאה HTTP, גם אם האירוע מוגדר בצורה שגויה או שחסרים בו פרמטרים נדרשים. כדי לוודא שהאירועים תקינים, אתם צריכים לבדוק אותם מול שרת האימות של Measurement Protocol לפני שתפרסו אותם בסביבת הייצור.
אחרי שמוודאים שהמבנה של האירועים תקין, צריך לאמת את ההטמעה כדי לוודא שמשתמשים במפתחות הנכונים.
אפשר להפעיל את שרת האימות ישירות, או להשתמש בכלי ליצירת אירועים של Google Analytics. הכלי ליצירת אירועים ב-Google Analytics מאפשר ליצור אירועים באופן אינטראקטיבי, והוא משתמש בשרת האימות של Measurement Protocol כדי לאמת אותם.
במדריך הזה מוסבר איך לשלוח אירועים לשרת האימות של Measurement Protocol ל-Google Analytics 4 ואיך לפרש את התגובה.
שליחת אירועים לצורך אימות
ההבדל היחיד בבקשה לאירועים שנשלחים אל Measurement Protocol ואל שרת האימות של Measurement Protocol הוא כתובת ה-URL.
שרת
כתובת URL
Measurement Protocol
/mp/collect
שרת האימות של Measurement Protocol
/debug/mp/collect
כל שאר השדות בבקשה זהים. לפרטים מלאים על בניית בקשה תקינה, אפשר לעיין בהפניה לפרוטוקול.
הקוד הבא מראה אירוע לא תקין שנשלח לשרת האימות של Measurement Protocol:
תשובת אימות
זוהי התשובה של שרת האימות לאירוע הקודם:
{"validationMessages":[{"fieldPath":"events","description":"Event at index: [0] has invalid name [_badEventName]. Names must start with an alphabetic character.","validationCode":"NAME_INVALID"}]}
[[["התוכן קל להבנה","easyToUnderstand","thumb-up"],["התוכן עזר לי לפתור בעיה","solvedMyProblem","thumb-up"],["סיבה אחרת","otherUp","thumb-up"]],[["חסרים לי מידע או פרטים","missingTheInformationINeed","thumb-down"],["התוכן מורכב מדי או עם יותר מדי שלבים","tooComplicatedTooManySteps","thumb-down"],["התוכן לא עדכני","outOfDate","thumb-down"],["בעיה בתרגום","translationIssue","thumb-down"],["בעיה בדוגמאות/בקוד","samplesCodeIssue","thumb-down"],["סיבה אחרת","otherDown","thumb-down"]],["עדכון אחרון: 2025-08-26 (שעון UTC)."],[[["\u003cp\u003eThe Measurement Protocol Validation Server helps ensure your Google Analytics 4 events are correctly formatted before deploying to production.\u003c/p\u003e\n"],["\u003cp\u003eThe Validation Server uses a different URL endpoint (\u003ccode\u003e/debug/mp/collect\u003c/code\u003e) than the standard Measurement Protocol (\u003ccode\u003e/mp/collect\u003c/code\u003e).\u003c/p\u003e\n"],["\u003cp\u003eValidation responses provide detailed error messages including the field path, description, and a validation code for easier debugging.\u003c/p\u003e\n"],["\u003cp\u003eEvents sent to the Validation Server are not processed and will not appear in your Google Analytics reports.\u003c/p\u003e\n"],["\u003cp\u003eThe Google Analytics Event Builder offers an interactive way to construct and validate events before sending them to the server.\u003c/p\u003e\n"]]],["To ensure valid events, use the Measurement Protocol Validation Server by sending requests to `/debug/mp/collect` instead of `/mp/collect`. Validate events before deploying them. This server doesn't log events in reports. It returns a response with `validationMessages`, an array detailing any errors like `NAME_INVALID`, `VALUE_REQUIRED`, or `VALUE_OUT_OF_BOUNDS`, specifying the `fieldPath`, `description`, and `validationCode` of the issue. Use the Google Analytics Event Builder for interactive event construction.\n"],null,[]]