تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
هذه المقالة مخصّصة للمطوّرين الذين يحتاجون إلى قياس نطاقات متعددة باستخدام
علامة Google نفسها. تركّز هذه المقالة على تنفيذ رمز gtag.js. يمكنك
أيضًا ضبط نطاقات إضافية في إعدادات علامة Google
لموقعك على "إحصاءات Google 4".
تتيح ميزة "القياس على جميع النطاقات" قياس موقعَين إلكترونيَين أو أكثر مرتبطَين على نطاقات منفصلة
كموقع إلكتروني واحد. توفّر علامات Google طريقة شائعة للمنتجات المتوافقة
لقياس النشاط عندما تمتدّ تجارب العملاء على نطاقات متعددة.
تعمل ميزة القياس على جميع النطاقات مع جميع منتجات Google، بما في ذلك "إحصاءات Google" وقياس الإحالات الناجحة في "إعلانات Google" والإحالات الناجحة في Floodlight.
حالات تطبيق القياس على جميع النطاقات
يمكنك تنفيذ ميزة "القياس على جميع النطاقات" عندما تحتاج إلى دمج بيانات نطاقين أو أكثر.
لنفترض أنّ لديك موقعًا إلكترونيًا على العنوان example-petstore.com، وأنّ ملف تعريف
التجارة الإلكترونية في موقعك الإلكتروني مستضاف على سلة تسوّق تابعة لجهة خارجية على نطاق آخر:
example-commerce-host.com/example-petstore.
بدون القياس على مستوى النطاقات، يتم احتساب المستخدِم الذي يصل إلى متجرك على الإنترنت وينتقل بعد ذلك إلى سلة التسوّق التابعة لجهة خارجية على أنّه مستخدِمَان منفصلان، ولهما جلستَان منفصلتَان بمُددَين مختلفتَين. عند استخدام ميزة القياس على جميع النطاقات، يتم تسجيل النشاط كمستخدم واحد.
آلية العمل
تشارك آلية ربط النطاقات ملفات تعريف ارتباط القياس التابعة للطرف الأول بين نطاق مصدر
ونطاق وجهة. يتم تخزين ملفات تعريف ارتباط القياس التابعة للطرف الأول في متصفِّح ويب، ولا يمكن الوصول إليها إلا من خلال صفحات موجودة على النطاق نفسه.
يتطلّب إعداد ميزة "القياس على جميع النطاقات" تنفيذ خطوتَين:
يُزيّن النطاق المصدر عناوين URL التي تشير إلى النطاق الوجهة لكي تحتوي على قيم ملفات تعريف ارتباط القياس التابعة للطرف الأول للنطاق المصدر.
يتحقّق النطاق الوجهة من توفّر ملفّات تعريف ارتباط مرتبطة بالقياس.
سيؤدي القياس على جميع النطاقات باستخدام علامات Google إلى إضافة مَعلمة رابط إلى عناوين URL
التي تشير إلى نطاق الوجهة. يتم تحديد مَعلمة الرابط في مَعلمات طلب البحث لعنوان URL باستخدام المفتاح _gl:
https://www.example.com/?_gl=1~abcde5~
في نطاق الوجهة، يتم إعداد العلامات للبحث عن مَعلمات الرابط في عنوان URL. وفي حال العثور على مَعلمة ربط صالحة، تستخرِج العلامة ملف تعريف ارتباط القياس
للطرف الأول وتخزّنه.
إعداد ميزة "الربط بين النطاقات"
لإعداد القياس على جميع النطاقات في النطاق المصدر لعناوين URL التي تشير إلى
النطاق الوجهة، عليك إنشاء عنصر linker. سيتحقّق الرابط
من النقرات على الروابط التي تشير إلى النطاقات الوجهة، وسيؤدي
ذلك تلقائيًا إلى إضافة مَعلمة رابط إلى عناوين URL لهذه الروابط.
يتطلب عنصر linker مَعلمة domains، وهي صفيف لنطاق واحد أو
أكثر. سيُلحق هذا الرمز المَعلمة linker بالروابط على صفحة تشير إلى نطاق مستهدَف 'example.com':
gtag.js
لإعداد ميزة "القياس على جميع النطاقات" لعلامة Google، أضِف الأمر linker
إلى علامتك على النحو التالي. استبدِل example.com بنطاقك.
يمكنك إدراج قيم سلاسل متعدّدة في السمة domains. عندما يحتوي موقع domains على قيمة واحدة على الأقل، ستقبل علامة gtag.js روابط النطاق الواردة تلقائيًا. يمكنك إضافة عدة قيم إلى خاصية domains
واستخدام مقتطف الرمز البرمجي نفسه على كل نطاق.
تلتزم "إحصاءات Google 4" بإعدادات gtag('set', 'linker', ...)، ما دام قد تم ضبط الأمر linker قبل الأمر config ذي الصلة.
ومع ذلك، ننصحك بضبط القياس على جميع النطاقات في صفحة "المشرف"
في "إحصاءات Google 4". التعرّف على كيفية إعداد القياس على جميع النطاقات
في أداة "إدارة العلامات من Google"، أنشئ علامة رابط إحالة ناجحة، ثم اضبط العلامة على
ربط النطاقات تلقائيًا.
انقر على العلامات > جديد.
انقر على ضبط العلامة واختر علامة ربط الإحالة الناجحة.
اختَر عامل تشغيل. في معظم الحالات، عليك استخدام عامل تشغيل يتم تنشيطه عند
جميع مشاهدات الصفحة على الويب لقياس الأداء على جميع النطاقات، أو على صفحات إحالات ناجحة
معيّنة سيصل إليها زوّار الموقع الإلكتروني بعد النقر على أحد الإعلانات.
اختَر تفعيل الربط على جميع النطاقات. سيسمح هذا الإعداد لهذه
العلامة بالتعامل مع الروابط الواردة التي تحتوي على مَعلمة ربط.
في نطاقات الربط التلقائي، أدخِل قائمة بالنطاقات التي يجب ربطها
بهذه العلامة. ستتم إضافة مَعلمة ربط مُلحقة بعنوان URL إلى أي روابط تشير إلى نطاق مُدرَج في هذا الحقل.
علامات "رابط الإحالة الناجحة" للإحالات الناجحة في "إعلانات Google" وFloodlight
اختَر تفعيل الربط على جميع النطاقات.
في حقل "نطاقات الربط التلقائي"، أدخِل قائمة بالنطاقات مفصولة
بفواصل.
إحصاءات Google 4
إعداد القياس على جميع النطاقات من خلال صفحات المشرف في "إحصاءات Google"
url_position
تتطلّب بعض تطبيقات المحتوى استخدام حرف العلامة/الترميز (#)
كفاصل في سلاسل عناوين URL بدلاً من استخدام علامة الاستفهام (?) الأكثر استخدامًا للإشارة إلى مَعلمات طلب البحث. لضبط مَعلمة الرابط
لظهورها في عنوان URL بعد الحرف # (مثل
https://example.com#_gl=1~abcde5~)، اضبط url_position على fragment.
علامات "رابط الإحالة الناجحة" للإحالات الناجحة في "إعلانات Google" وFloodlight
إذا كنت بحاجة إلى إعلام أداة "إدارة العلامات من Google" بقراءة المَعلمة الفريدة من جزء
(#) بدلاً من طلب بحث عادي (?)، اضبط موضع عنوان URL على الجزء.
وبخلاف ذلك، اترك هذا الخيار مضبوطًا على خيار مَعلمة طلب البحث التلقائي.
تاريخ التعديل الأخير: 2024-11-15 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2024-11-15 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003eThis guide explains how to implement cross-domain measurement with Google tags (gtag.js) to track user journeys across multiple related websites as a single user.\u003c/p\u003e\n"],["\u003cp\u003eCross-domain measurement is essential when you need to consolidate data from two or more domains, such as an online store and a separate shopping cart domain.\u003c/p\u003e\n"],["\u003cp\u003eIt works by sharing first-party measurement cookies between domains using a linker parameter appended to URLs, enabling unified user tracking.\u003c/p\u003e\n"],["\u003cp\u003eSetup involves creating a \u003ccode\u003elinker\u003c/code\u003e object in gtag.js or using the Conversion Linker tag in Google Tag Manager, specifying the linked domains.\u003c/p\u003e\n"],["\u003cp\u003eGoogle Analytics 4 users should preferably configure cross-domain measurement through the Admin interface instead of directly through tags.\u003c/p\u003e\n"]]],["Cross-domain measurement combines data from multiple domains into a single user journey. Implementation involves setting up a `linker` object on the source domain to append a linker parameter (`_gl`) to URLs leading to destination domains. This allows first-party cookie sharing. In gtag.js, use `gtag('set', 'linker', {'domains': [...]})` to specify domains. Tag Manager requires configuring a Conversion Linker tag and enabling auto-linking. The destination domain must be configured to accept incoming linker parameters, either automatically or by setting `accept_incoming` to true.\n"],null,["# Measure activity across multiple domains\n\n\u003e This article is for developers who need to measure multiple domains with the\n\u003e same Google tag. This article focuses on a gtag.js code implementation. You\n\u003e can also configure additional domains in your [Google tag settings](https://support.google.com/tagmanager/answer/12131703#Domains&zippy=%2Cconfigure-your-domains)\n\u003e of your GA4 property.\n\nCross-domain measurement enables two or more related sites on separate domains\nto be measured as one. Google tags provide a common way for supported products\nto measure activity when your customer journeys span across multiple domains.\nCross-domain measurement works for all Google products, including Google\nAnalytics, Google Ads conversion measurement, and Floodlight conversions.\n\nWhen to implement cross-domain measurement\n------------------------------------------\n\nImplement cross-domain measurement when you need to combine data for two or more\ndomains.\n\nSuppose you have a website at `example-petstore.com`, and your website's\necommerce component is hosted by a third-party shopping cart on another domain:\n`example-commerce-host.com/example-petstore`.\n\n*Without* cross-domain measurement, a user who arrives to your online store and\nthen proceeds to your third-party shopping cart is counted as two separate\nusers, with two separate sessions of different durations. *With* cross-domain\nmeasurement, activity is captured as a single user.\n\nHow it works\n------------\n\nThe domain linker shares first-party measurement cookies between a source domain\nand a destination domain. The first-party measurement cookies are stored in a\nweb browser, and can only be accessed by pages on the same domain.\n\nSetup for cross-domain measurement is a two-step process:\n\n1. The source domain decorates URLs that point to the destination domain so that they contain the first-party measurement cookie values of the source domain.\n2. The destination domain checks for the presence of linked measurement cookies.\n\nCross-domain measurement with Google tags will add a linker parameter to URLs\nthat point to the destination domain. The linker parameter is identified in URL\nquery parameters with the key `_gl`: \n\n https://www.example.com/?_gl=1~abcde5~\n\nOn the destination domain, tags are configured to check for linker parameters in\nthe URL. If a valid linker parameter is found, the tag extracts the first-party\nmeasurement cookie and stores it.\n\nSet up cross-domain linking\n---------------------------\n\nTo set up cross-domain measurement on the source domain for URLs that point to\nthe destination domain, you need to create a `linker` object. The linker will\nlisten for clicks on links that point to destination domains, and it will\nautomatically add a linker parameter to the URLs of those links.\n| **Note:** Linker parameters expire after two minutes, so the linker parameter is only added at the time of the click event.\n\nThe `linker` object requires a `domains` parameter, which is an array of one or\nmore domains. This code will append the linker parameter to links on a page that\npoints to a target domain *'example.com'*: \n\n### gtag.js\n\nTo set up cross-domain measurement for the Google tag, add a `linker`\ncommand to your tag as follows. Replace `example.com` with your domain.\n**Note:** To ensure `set` values are available for `config` commands and available to any dynamically loaded containers, add the `set` commands above the `js` command. \n\n \u003cscript async src=\"https://www.googletagmanager.com/gtag/js?id=TAG_ID\"\u003e\u003c/script\u003e\n \u003cscript\u003e\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('set', 'linker', {'domains': \\['example.com'\\]});\n gtag('js', new Date());\n\n gtag('config', 'TAG_ID');\n \u003c/script\u003e\n\nYou can list multiple string values in the `domains` property. When the\n`domains` property has at least one value, gtag.js will accept incoming\ndomain links by default. You can add several values to the `domains` propety\nand use the same code snippet on every domain.\n\nGoogle Analytics 4 honors `gtag('set', 'linker', ...)` configurations, so\nlong as the `linker` command is set before the relevant `config` command.\nHowever, we recommend configuring cross-domain measurement on the Admin page\nof Google Analytics 4. [Learn how to set up cross domain\nmeasurement](https://support.google.com/analytics/answer/10071811#setup) \n\n gtag('set', 'linker', {\n 'domains': \\['example.com', 'example-b.com'\\]\n });\n\n| **Note:** The Google tag will match against any link with a hostname that contains a value found in the `domains` array.\n\n### Tag Manager\n\n### For Google Ads and Floodlight tags\n\nIn Tag Manager, create a **Conversion Linker** tag and then set the tag to\nauto-link domains.\n\n1. Click **Tags \\\u003e New**.\n2. Click **Tag Configuration** and select **Conversion Linker**.\n3. Select a trigger. In most cases, you should use a trigger that fires on all page views for cross domain measurement, or on specific conversion pages where site visitors will land after an ad is clicked.\n4. Select **Enable linking across domains**. This setting will enable this tag to handle incoming links that have a linker parameter.\n5. In **Auto Link Domains**, enter a list of domains that should be linked with this tag. Any links that point to a domain listed in this field will have a linker parameter appended to the URL.\n6. Save and publish your tag configuration.\n\n[Learn more about Tag Manager's Conversion Linker](https://support.google.com/tagmanager/answer/7549390)\n\n### For Google Analytics 4 tags\n\nIn Google Analytics 4, cross-domain measurement is configured via the Google\nAnalytics Admin interface. [Learn how to set up cross domain measurement\nwith Google Analytics 4](https://support.google.com/analytics/answer/10071811).\n| **Note:** The preferred method is to make changes to the Google Analytics Settings variable, so that changes are shared across multiple tags.\n\n1. In the **Auto Link Domains** field, enter a comma-separated list of domains.\n2. To receive incoming links from other domains, navigate to **More\n Settings \\\u003e Fields to Set** and add a field with a Field Name of *allowLinker* and a **Value** of *true*.\n3. Save your changes and publish the container.\n\nLinker parameter reference\n--------------------------\n\n| Parameter | Type | Accepted values |\n|---------------------------------------|---------|--------------------------------------------------------------------------|\n| [`accept_incoming`](#accept_incoming) | boolean | `true` (default if `domains` has value), `false` |\n| [`decorate_forms`](#decorate_forms) | boolean | `true`, **`false`** (default) |\n| [`domains`](#domains) | array | An array of one or more domains, e.g. `['example1.com', 'example2.com']` |\n| [`url_position`](#url_position) | string | `'query'` (default), `'fragment'` |\n\n### `accept_incoming`\n\nOnce a user arrives at a page on the destination domain with a linker parameter\nin the URL, your tags need to be configured to parse that parameter.\n\nIf the destination domain has been configured to automatically link domains, it\nwill accept linker parameters by default. No additional code is required on the\ndestination domain.\n\nIf the destination domain is *not* configured to automatically link domains, you\ncan instruct the destination page to look for linker parameters. Set the\n`accept_incoming` property to `true`. \n\n### gtag.js\n\n gtag('set', 'linker', {\n 'accept_incoming': true\n });\n\n### Tag Manager\n\n#### Conversion Linker tags for Google Ads and Floodlight conversions\n\nActivate the **Accept incoming linker parameters** checkbox.\n\n### `decorate_forms`\n\nTo measure form data that is sent between multiple domains, set the\n`decorate_forms` property to `true`. \n\n### gtag.js\n\n gtag('set', 'linker', {\n 'domains': ['example.com'],\n 'decorate_forms': true\n });\n\n### Tag Manager\n\n#### Conversion Linker tags for Google Ads and Floodlight conversions\n\nSet **Decorate Forms** to *true*.\n\n#### Google Analytics 4 tags\n\nThere is no control for `decorate_forms` for Google Analytics tags in Tag\nManager. Refer to the gtag.js guidance instead.\n\n### `domains`\n\nAn array of one or more domains to be linked. \n\n### gtag.js\n\n gtag('set', 'linker', {\n 'domains': \\[\n 'example1.com',\n 'example2.com',\n 'subdomain1.example3.com',\n 'subdomain2.example3.com'\n \\]\n });\n\n### Tag Manager\n\n#### Conversion Linker tags for Google Ads and Floodlight conversions\n\n1. Select *Enable linking across domains*\n2. In the Auto Link Domains field, enter a list of domains separated by commas.\n\n#### Google Analytics 4\n\nSet up cross domain measurement via the [Admin](https://support.google.com/analytics/answer/10071811) pages in Google Analytics.\n\n### `url_position`\n\nCertain content applications require you to use a fragment/hash character (`#`)\nas the delimiter in URL strings instead of the more commonly used question mark\ncharacter (`?`) to indicate query parameters. To configure the linker parameter\nto appear in the URL after a `#` character (e.g.\n`https://example.com#_gl=1~abcde5~`), set `url_position` to `fragment`. \n\n### gtag.js\n\n gtag('set', 'linker', {\n 'domains': ['example.com'],\n 'decorate_forms': true,\n 'url_position': 'fragment'\n });\n\n### Tag Manager\n\n#### Conversion Linker tags for Google Ads and Floodlight conversions\n\nIf you need to tell Tag Manager to read the unique parameter from a fragment\n(`#`) instead of a standard query (`?`), set **URL Position** to *Fragment* .\nOtherwise, leave this option set to the default *Query Parameter* option."]]