Analytics एडमिन सेवा
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
Analytics एडमिन सेवा की मदद से, Apps Script में Google Analytics Admin API v1 का इस्तेमाल किया जा सकता है. Google Analytics Admin API की मदद से, Google Analytics 4 (GA4) के कॉन्फ़िगरेशन डेटा को प्रोग्राम के हिसाब से ऐक्सेस किया जा सकता है. यह सिर्फ़ GA4 प्रॉपर्टी के साथ काम करता है.
रेफ़रंस
इस सेवा के बारे में ज़्यादा जानकारी के लिए, Google Analytics Admin API v1 देखें.
Apps Script की सभी ऐडवांस सेवाओं की तरह, AnalyticsAdmin सेवा भी सार्वजनिक एपीआई के ऑब्जेक्ट, तरीकों, और पैरामीटर का इस्तेमाल करती है. ज़्यादा जानकारी के लिए, तरीके के सिग्नेचर कैसे तय किए जाते हैं लेख पढ़ें.
समस्याओं की शिकायत करने और अन्य सहायता पाने के लिए, Google Analytics Admin API v1 का सहायता पेज देखें.
नमूना कोड
रिपोर्ट चलाना
इस सैंपल में, accounts.list() तरीके का इस्तेमाल करके, किसी उपयोगकर्ता के लिए उपलब्ध सभी Google Analytics खातों की सूची दिखाई गई है.
जब तक कुछ अलग से न बताया जाए, तब तक इस पेज की सामग्री को Creative Commons Attribution 4.0 License के तहत और कोड के नमूनों को Apache 2.0 License के तहत लाइसेंस मिला है. ज़्यादा जानकारी के लिए, Google Developers साइट नीतियां देखें. Oracle और/या इससे जुड़ी हुई कंपनियों का, Java एक रजिस्टर किया हुआ ट्रेडमार्क है.
आखिरी बार 2025-08-31 (UTC) को अपडेट किया गया.
[null,null,["आखिरी बार 2025-08-31 (UTC) को अपडेट किया गया."],[[["\u003cp\u003eThe Analytics Admin service in Apps Script enables programmatic access to Google Analytics 4 (GA4) configuration data using the Google Analytics Admin API v1.\u003c/p\u003e\n"],["\u003cp\u003eIt is an advanced service that requires enabling before use and is exclusively compatible with GA4 properties.\u003c/p\u003e\n"],["\u003cp\u003eThis service mirrors the objects, methods, and parameters of the public API, providing consistent functionality.\u003c/p\u003e\n"],["\u003cp\u003eSupport and issue reporting can be found on the Google Analytics Admin API v1 support page.\u003c/p\u003e\n"],["\u003cp\u003eA provided sample code demonstrates listing all Google Analytics accounts accessible to the current user.\u003c/p\u003e\n"]]],[],null,["# Analytics Admin Service\n\nThe Analytics Admin service allows you to use the [Google Analytics Admin API v1](/analytics/devguides/config/admin/v1)\nin Apps Script. The Google Analytics Admin API allows for programmatic access\nto the Google Analytics 4 (GA4) configuration data and is only compatible with GA4 properties.\n| **Note:** This is an advanced service that must be [enabled before use](/apps-script/guides/services/advanced).\n\nReference\n---------\n\nFor detailed information on this service, see the [Google Analytics Admin API v1](/analytics/devguides/config/admin/v1/rest).\n\nLike all advanced services in Apps Script, the AnalyticsAdmin service uses the\nsame objects, methods, and parameters as the public API. For more information,\nsee [How method signatures are determined](/apps-script/guides/services/advanced#how_method_signatures_are_determined).\n\nTo report issues and find other support, see the\n[Google Analytics Admin API v1 support page](/analytics/devguides/config/admin/v1/help).\n\nSample code\n-----------\n\n### Run a report\n\nThe sample lists all the Google Analytics accounts available to a user by calling\nthe [accounts.list()](/analytics/devguides/config/admin/v1/rest/v1alpha/accounts/list)\nmethod. \nadvanced/analyticsAdmin.gs \n[View on GitHub](https://github.com/googleworkspace/apps-script-samples/blob/main/advanced/analyticsAdmin.gs) \n\n```javascript\n/**\n * Logs the Google Analytics accounts accessible by the current user.\n */\nfunction listAccounts() {\n try {\n accounts = AnalyticsAdmin.Accounts.list();\n if (!accounts.items || !accounts.items.length) {\n console.log('No accounts found.');\n return;\n }\n\n for (let i = 0; i \u003c accounts.items.length; i++) {\n const account = accounts.items[i];\n console.log('Account: name \"%s\", displayName \"%s\".', account.name, account.displayName);\n }\n } catch (e) {\n // TODO (Developer) - Handle exception\n console.log('Failed with error: %s', e.error);\n }\n}\n```"]]