संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
यह लेख उन डेवलपर के लिए है जो अपनी वेबसाइट के फ़र्स्ट पार्टी कॉन्टेक्स्ट में, सर्वर साइड टैगिंग को होस्ट करना चाहते हैं. सेम-ऑरिजन सर्विंग सबसे सही तरीका है. इससे आपको सर्वर पर सेट होने वाली कुकी से जुड़ी सुरक्षा और उसके लंबे समय तक सर्वर पर स्टोर रहने से जुड़े फ़ायदे मिलते हैं. यहां दिए गए निर्देश, एक ही ऑरिजिन से विज्ञापन दिखाने की सुविधा सेट अप करने के लिए लागू होते हैं. भले ही, आपकी साइट पर gtag.js या gtm.js, दोनों में से कोई भी Google टैग डिप्लॉय किया गया हो.
टैगिंग सर्वर को पहली बार सेट अप करने पर, उसे क्लाउड सेवा देने वाली कंपनी के दिए गए डोमेन पर होस्ट किया जाता है. डिफ़ॉल्ट एंडपॉइंट का इस्तेमाल करने पर, यह डेटा को सर्वर कंटेनर में डिलीवर करता है. हालांकि, यह तीसरे पक्ष के संदर्भ में चलता है. पहले पक्ष के कॉन्टेक्स्ट के फ़ायदे पाने के लिए, आपके टैगिंग सर्वर और वेबसाइट को एक ही डोमेन पर चलाना होगा. इससे, आपको ज़्यादा समय तक सेव रहने वाली कुकी जैसी सुविधाएं मिलती हैं.
नीचे दी गई टेबल में बताया गया है कि पैरंट वेबसाइट को www.example.com पर होस्ट करने पर, टैग करने वाले सर्वर को कैसे होस्ट किया जा सकता है:
एक ही ऑरिजिन (सबसे सही तरीका)
सबडोमेन
डिफ़ॉल्ट डोमेन
यूआरएल का उदाहरण
https://www.example.com/metrics
https://metrics.example.com
https://metrics.run.app
सर्वर से सेट की गई कुकी का ऐक्सेस
सुरक्षा और लंबे समय तक चलने से जुड़े फ़ायदों का पूरा ऐक्सेस.
सुरक्षा और लंबे समय तक चलने से जुड़े फ़ायदों का पूरा ऐक्सेस.
कोई नहीं. सिर्फ़ JavaScript कुकी सेट की जा सकती हैं.
सेटअप करने में लगने वाला समय
अनुरोधों को फ़ॉरवर्ड करने के लिए, सीडीएन या लोड बैलेंसर को कॉन्फ़िगर करें. डीएनएस एंट्री अपडेट करने की ज़रूरत पड़ सकती है.
[null,null,["आखिरी बार 2025-06-27 (UTC) को अपडेट किया गया."],[[["\u003cp\u003eThis article guides developers on hosting server-side tagging in a first-party context for enhanced security and cookie durability.\u003c/p\u003e\n"],["\u003cp\u003eAchieving same-origin serving involves configuring your tagging server and website to run on the same domain, which can be done using a subdomain or by forwarding requests to a specific path on your main domain.\u003c/p\u003e\n"],["\u003cp\u003eServer-side tagging hosted on the default domain lacks access to crucial server-set cookie benefits, unlike same-origin setups.\u003c/p\u003e\n"],["\u003cp\u003eSetting up same-origin serving requires updating DNS entries or configuring a CDN/load balancer, depending on the chosen method.\u003c/p\u003e\n"],["\u003cp\u003eBefore implementing same-origin serving, ensure you've established a server container in Tag Manager and set up a tagging server.\u003c/p\u003e\n"]]],["To leverage server-set cookie benefits, host your tagging server in the same first-party context as your website. Options include using the same origin (e.g., `www.example.com/metrics`) or a subdomain (e.g., `metrics.example.com`). Both allow full cookie access, unlike the default provider-hosted domain. Implementing same-origin requires a CDN/load balancer and potential DNS updates, while subdomains only need DNS adjustments. Pre-setup of a server container and tagging server is required.\n"],null,["# Custom domain configuration\n\n\u003e This article is for developers who want to host server-side tagging in the\n\u003e same [first-party context](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#tracking_and_privacy) as their website. Same-origin serving is a best\n\u003e practice that lets you leverage the security and durability benefits of\n\u003e server-set cookies. The below instructions apply for setting up same-origin\n\u003e serving regardless of the Google tag deployed on your site (gtag.js or\n\u003e gtm.js).\n\nWhen you first set up a tagging server, it is hosted on a domain provided by the\ncloud provider. When you use the default endpoint, it delivers data to the\nserver container, but runs in a third-party context. To unlock the benefits of a\nfirst-party context, such as more durable cookies, your tagging server and your\nwebsite have to run on the same domain.\n\nThe table below illustrates how you can host a tagging server when the parent\nwebsite is hosted on `www.example.com`:\n\n| | Same origin (best practice) | Subdomain | Default domain |\n|--------------------------|---------------------------------------------------------------------------------------|--------------------------------------------------|--------------------------------------------|\n| Example URL | `https://www.example.com/metrics` | `https://metrics.example.com` | `https://metrics.run.app` |\n| Server-set cookie access | Full access to security and durability benefits. | Full access to security and durability benefits. | **None.** Can only set Javascript cookies. |\n| Setup complexity | Configure a CDN or load balancer to forward requests. May need to update DNS entries. | Update DNS entries. | Comes pre-configured. |\n\nPick your implementation option to get started.\n\nSubdomain Same origin\n\nPrerequisites\n-------------\n\nThis guide assumes that you have:\n\n- Set up a server container in [Tag Manager](/tag-platform/tag-manager/server-side/overview#create_a_tag_manager_server_container)\n- [Set up a tagging server](/tag-platform/tag-manager/server-side/overview#set_up_a_tagging_server)\n\nConfigure the custom domain\n---------------------------\n\nPick an implementation option."]]