تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
يتيح لك بروتوكول Measurement Protocol من "إحصاءات Google" إرسال البيانات المتوفّرة بلا إنترنت إلى مصدر بيانات موقعك الإلكتروني أو تطبيقك، بالإضافة إلى البيانات التي تجمعها حاليًا باستخدام وضع العلامات أو حزمة تطوير البرامج (SDK) لمنصة Firebase.
يوضّح هذا الدليل حالات الاستخدام الشائعة في Google Analytics Measurement Protocol ومتطلباتها.
ملخّص المتطلبات
يوفر هذا الجدول مرجعًا سريعًا حول المتطلبات لكل حالة استخدام. يُرجى مراعاة أفضل الممارسات التالية:
يتم ضبط القيمة التلقائية لـ timestamp_micros في الأحداث وخاصيّات المستخدمين على وقت الطلب. عند إرسال تغيير تم في الماضي على حدث أو خاصيّة مستخدم، تجاهل الطابع الزمني كما هو موضّح في دليل إرسال الأحداث ودليل خصائص المستخدمين.
لكي تكون تقارير "الوقت الفعلي" ومقاييس التفاعل دقيقة، ضمِّن مَعلمة الحدث engagement_time_msec مع ضبطها على المدة المنقضية منذ الحدث السابق بالملّي ثانية.
حالة الاستخدام
معرّف الجلسة
شرط وقت الطلب
متطلبات timestamp_micros
تعيين User-ID للأحداث
مطلوب
<= نهاية الجلسة وبداية يوم العمل
>= بداية الجلسة <= ونهاية الجلسة
تحديد مصدر الجلسة
مطلوب
<= بداية الجلسة + 24 ساعة
>= بداية الجلسة <= ونهاية الجلسة
استيراد الأحداث إلى المنصات الإعلانية
غير مطلوب
<= يوم العمل لآخر جلسة + 63 يومًا
>= وقت الطلب ناقص يومَي عمل و <= وقت الطلب
إرسال الأحداث أو خاصيّات المستخدمين لإنشاء شرائح الجمهور
غير مطلوب
الموقع الإلكتروني: <= وقت آخر حدث على الإنترنت + 30 يومًا
التطبيق: <= وقت آخر حدث على الإنترنت + 42 يومًا
>= وقت الطلب ناقص يومَي عمل و <= وقت الطلب
تعيين User-ID للأحداث
استخدِم Measurement Protocol لتزويد الأحداث على الإنترنت أو بلا إنترنت برقم تعريف User-ID.
في ما يلي بعض الأمثلة على حالات الاستخدام لإضافة User-ID إلى حدث:
لا يتضمّن قياسك على الإنترنت المعلومات اللازمة للبحث عن رقم تعريف المستخدم للأحداث على الإنترنت، ولكن لديك مسار معالجة أحداث يمكنه الربط بين جلسة على الإنترنت ورقم تعريف المستخدم.
في هذا السيناريو، أنت تستخدم Measurement Protocol لتوفير أحداث على الإنترنت مع User-ID.
ليس لديك رقم تعريف المستخدِم للأحداث التي ترسلها باستخدام Measurement Protocol، ولكنّك تريد ربط هذه الأحداث برقم تعريف المستخدِم إذا سجّل المستخدِم الدخول على الإنترنت خلال الجلسة.
في هذا السيناريو، أنت تستخدم أحداثًا على الإنترنت لتزويد أحداث
Measurement Protocol برقم تعريف المستخدم.
في ما يلي متطلبات إضافة User-ID إلى حدث:
أدرِج session_id في قائمة مَعلمات الحدث.
أرسِل أحداث Measurement Protocol في يوم العمل نفسه الذي تم فيه تسجيل الجلسة على الإنترنت.
في حال تجاهل timestamp_micros، اضبطه على طابع زمني بين وقتَي بدء الجلسة على الإنترنت وانتهائها.
إذا كان هدفك هو تقديم User-ID للأحداث على الإنترنت، اضبط user_id في الطلب.
إذا كان هدفك هو أن يتضمّن كل حدث في Measurement Protocol رقم تعريف المستخدم من الجلسة المقابلة على الإنترنت، لن تحتاج إلى ضبط user_id.
تحديد مصدر الجلسة
تظهر أحداث Measurement Protocol التي تستوفي متطلبات معيّنة في التقارير
مع سمات الجلسة نفسها (مثل المعلومات الجغرافية والمصدر
والوسيط والحملة) مثل الأحداث على الإنترنت من الجلسة نفسها.
في ما يلي متطلبات تحديد مصدر الجلسات:
أدرِج session_id في قائمة مَعلمات الحدث.
أرسِل الطلب في غضون 24 ساعة من بدء الجلسة على الإنترنت.
على سبيل المثال، إذا بدأت الجلسة في الساعة 11:15 صباحًا يوم الاثنين في المنطقة الزمنية لموقعك، أرسِل الطلب قبل الساعة 11:15 صباحًا يوم الثلاثاء.
في حال تجاهل timestamp_micros، اضبطه على طابع زمني بين وقتَي بدء الجلسة على الإنترنت وانتهائها.
استيراد الأحداث إلى المنصات الإعلانية
تتضمّن "إحصاءات Google" الأحداث التي تُرسلها باستخدام Measurement Protocol
في عمليات التصدير إلى المنتجات الإعلانية المرتبطة، مثل "إعلانات Google" أو "مدير الحملة"
360.
في ما يلي بعض السيناريوهات الشائعة التي يكون فيها ذلك مفيدًا:
لديك أحداث غير إلكترونية لنشاطك التجاري تريد تضمينها في تحديد مصدر الإحالة الناجحة وإعداد التقارير بشأن الإعلانات.
لديك أحداث إضافية في نظام غير متاح لوضع العلامات أو حزمة تطوير البرامج (SDK) في Firebase، ولكنّك لا تزال تريد تضمين هذه الأحداث في المنتجات المرتبطة.
في ما يلي متطلبات استيراد الأحداث إلى المنصات الإعلانية:
أرسِل الطلب في موعد لا يتجاوز نهاية يوم العمل بعد 63 يومًا من آخر حدث على الإنترنت، حتى إذا كانت فترة تحديد المصدر للحدث الرئيسي تزيد عن 63 يومًا.
على سبيل المثال، إذا كان آخر حدث على الإنترنت client_id أو app_instance_id قد وقع في 1 آذار (مارس)، أرسِل حدث Measurement Protocol في موعد أقصاه نهاية يوم العمل في 3 أيار (مايو).
في حال تجاهلت timestamp_micros، اضبطها على طابع زمني ضمن آخر ثلاثة أيام عمل.
إرسال الأحداث أو خاصيّات المستخدمين لإنشاء شرائح الجمهور
يتم تضمين الأحداث وخصائص المستخدمين التي يتم إرسالها باستخدام Measurement Protocol في تقييم شروط الجمهور إذا استوفيت بعض المتطلبات.
في ما يلي متطلبات إرسال الأحداث أو خصائص المستخدمين لإنشاء شرائح الجمهور:
أرسِل الطلب إلى مصدر بيانات على الويب في موعد أقصاه نهاية يوم العمل بعد 30 يومًا من آخر حدث على الإنترنت لنفس client_id.
على سبيل المثال، إذا وقع آخر حدث على الإنترنت client_id في 1 آذار (مارس)، أرسِل حدث Measurement Protocol في موعد أقصاه نهاية يوم العمل في 31 آذار (مارس).
أرسِل الطلب إلى App stream في موعد أقصاه نهاية يوم العمل بعد 42 يومًا من آخر حدث على الإنترنت لنفس app_instance_id.
على سبيل المثال، إذا وقع آخر حدث على الإنترنت app_instance_id في 1 مارس، أرسِل حدث Measurement Protocol في موعد أقصاه نهاية يوم العمل في 12 أبريل.
في حال تجاهلت timestamp_micros، اضبطها على طابع زمني ضمن آخر 3 أيام عمل.
تاريخ التعديل الأخير: 2025-07-29 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","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-07-29 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003eThe Google Analytics Measurement Protocol allows you to send offline data, supplementing your existing online data collection.\u003c/p\u003e\n"],["\u003cp\u003eThis protocol enables you to assign User IDs to events, attribute sessions, export events for advertising, and leverage data for audience creation within Google Analytics.\u003c/p\u003e\n"],["\u003cp\u003eSpecific requirements, including session IDs and timestamps, must be met for each use case to ensure data accuracy and integration with online data.\u003c/p\u003e\n"],["\u003cp\u003eRefer to the provided tables and guidelines for detailed requirements and best practices for each use case, such as session attribution and audience creation.\u003c/p\u003e\n"],["\u003cp\u003eAdhering to these guidelines ensures accurate reporting, attribution, and audience creation based on both online and offline data within your Google Analytics property.\u003c/p\u003e\n"]]],["The Google Analytics Measurement Protocol allows sending offline data to web or app streams. Key actions include: assigning User-IDs to events (requiring a `session_id`, same-day processing, and specific `timestamp_micros`), attributing sessions (requiring `session_id` and submission within 24 hours of session start), exporting events to advertising platforms (no `session_id` required, must be sent within 63 days of the last online event), and using data for audience creation (no `session_id`, web data must be sent within 30 days and app data within 42 days of the last event).\n"],null,["# Measurement protocol use cases\n\nThe Google Analytics Measurement Protocol lets you send offline data to your Web or App stream, in\naddition to the data you're already collecting with tagging or the Firebase SDK.\n\nThis guide describes common Google Analytics Measurement Protocol use cases and their requirements.\n| **Key Term:** In this guide, \"business day\" is the business day of an event or session in the [time zone of your property](//support.google.com/adsense/answer/9830725).\n\nSummary of requirements\n-----------------------\n\nThis table provides a quick reference of the requirements for each use\ncase. Keep the following best practices in mind:\n\n1. The `timestamp_micros` of events and user properties defaults to the request\n time. When sending an event or user property change that occurred in the\n past, override the timestamp as described in the [sending events](/analytics/devguides/collection/protocol/ga4/sending-events) guide and\n the [user properties](/analytics/devguides/collection/protocol/ga4/user-properties) guide.\n\n2. For accurate Realtime reports and engagement metrics, include the\n `engagement_time_msec` event parameter set to the milliseconds elapsed since\n the preceding event.\n\n| Use case | Session ID | Request time requirement | `timestamp_micros` requirement |\n|------------------------------------------------------|--------------|-----------------------------------------------------------------------------------------|---------------------------------------------------------------|\n| Assign User-ID to events | Required | \\\u003c= end of the session start's business day | \\\u003e= session start and \\\u003c= session end |\n| Session attribution | Required | \\\u003c= session start + 24 hours | \\\u003e= session start and \\\u003c= session end |\n| Export events to advertising platforms | Not required | \\\u003c= last session business day + 63 days | \\\u003e= request time minus two business days and \\\u003c= request time |\n| Send events or user properties for audience creation | Not required | Web: \\\u003c= latest online event time + 30 days App: \\\u003c= latest online event time + 42 days | \\\u003e= request time minus two business days and \\\u003c= request time |\n\nAssign User-ID to events\n------------------------\n\nUse the Measurement Protocol to provide online or offline events with a\n[User-ID](//support.google.com/analytics/answer/9213390).\n\nHere are some example use cases for adding a User-ID to an event:\n\n1. Your online measurement lacks the information needed to look up the\n User-ID for online events, but you have an event-processing pipeline that\n is able to make the association between an online session and a User-ID.\n\n In this scenario, you are using the Measurement Protocol to provide\n *online* events with a User-ID.\n2. You don't have the User-ID for events you are sending with the\n Measurement Protocol, but you want those events to be associated with a\n User-ID if the user logged in online over the course of the session.\n\n In this scenario, you are using online events to provide\n *Measurement Protocol* events with a User-ID.\n\nHere are the requirements to add a User-ID to an event:\n\n- Include the `session_id` in the event's parameter list.\n- Send the Measurement Protocol events on the *same business day* as the online session.\n- If you override `timestamp_micros`, set it to a timestamp between the start and end time of the online session.\n- If your goal is to provide User-ID for online events, set the `user_id` in the request.\n- If your goal is for each Measurement Protocol event to have the User-ID from its corresponding online session, you don't need to set `user_id`.\n\nSession attribution\n-------------------\n\nMeasurement Protocol events that meet specific requirements appear in reports\nwith the same session attributes (such as geographic information, source,\nmedium, and campaign) as online events from the same session.\n\nHere are the requirements for session attribution:\n\n- Include the `session_id` in the event's parameter list.\n- Send the request no later than 24 hours after the start of the online\n session.\n\n For example, if the session started at 11:15 AM on Monday in your property's\n time zone, send the request before 11:15 AM on Tuesday.\n- If you override `timestamp_micros`, set it to a timestamp between the\n start and end time of the online session.\n\nExport events to advertising platforms\n--------------------------------------\n\nGoogle Analytics includes the events you send using Measurement Protocol\nin exports to linked advertising products such as Google Ads or Campaign Manager\n360.\n| **Tip:** This use case doesn't require `session_id`.\n\nA few common scenarios where this is useful include:\n\n- Your business has offline events that you want included in advertising attribution and reporting.\n- You have additional events in a system that is not available to tagging or the Firebase SDK, but you still want to include those events in linked products.\n\nHere are the requirements to export events to advertising platforms:\n\n- Send the request no later than the end of the business day 63 days after\n the latest online event, even if the key event's attribution window is more\n than 63 days.\n\n For example, if the latest online event for the `client_id` or\n `app_instance_id` occurred on March 1, send the Measurement Protocol\n event no later than the end of the business day on May 3.\n- If you override `timestamp_micros`, set it to a timestamp within the last\n three business days.\n\nSend events or user properties for audience creation\n----------------------------------------------------\n\nEvents and user properties sent using Measurement Protocol are included in\nthe evaluation of [audience conditions](//support.google.com/analytics/answer/9267572) if you adhere to a few requirements.\n| **Tip:** This use case doesn't require `session_id`.\n\nHere are the requirements to send events or user properties for audience\ncreation:\n\n- Send the request to a Web stream no later than the end of the business day\n 30 days after the latest online event for the same `client_id`.\n\n For example, if the latest online event for the `client_id` occurred on\n March 1, send the Measurement Protocol event no later than the end of the\n business day on March 31.\n- Send the request to an App stream no later than the end of the business day\n 42 days after the latest online event for the same `app_instance_id`.\n\n For example, if the latest online event for the `app_instance_id` occurred\n on March 1, send the Measurement Protocol event no later than the end of\n the business day on April 12.\n- If you override `timestamp_micros`, set it to a timestamp within the last 3\n business days."]]