संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
क्रैश की संख्या और टाइप को मेज़र करने के लिए, अपवाद वाले इवेंट भेजे जा सकते हैं या
किसी वेब पेज पर होने वाली गड़बड़ियां. इस पेज पर बताया गया है कि मैसेज भेजने के लिए, gtag.js का इस्तेमाल कैसे करना है
सभी अपवाद हैं.
लागू करना
कोई गड़बड़ी होने पर, Google Analytics को अपवाद इवेंट भेजें:
जहां <exception_parameters> एक या ज़्यादा पैरामीटर-वैल्यू पेयर है. अलग करें
कॉमा लगाकर, हर जोड़ी को कॉमा से. उदाहरण के लिए, यह निर्देश एक साधारण गड़बड़ी भेजता है
अपवाद.
gtag('event', 'exception', {
'description': 'error_description',
'fatal': false // set to true if the error is fatal
});
अपवाद के पैरामीटर
नीचे दी गई टेबल में अपवाद के पैरामीटर दिए गए हैं:
पैरामीटर का नाम
डेटा टाइप
ज़रूरी है
ब्यौरा
description
स्ट्रिंग
नहीं
गड़बड़ी के बारे में जानकारी.
fatal
बूलियन
नहीं
true.
उदाहरण
यह फ़ंक्शन दिया गया है:
function divide(x, y) {
if (y === 0) {
throw "Division by zero";
}
return x/y;
}
नीचे दिया गया कोड Google Analytics को अपवाद इवेंट भेजेगा, अगर
भाजक y शून्य है:
var x = document.getElementById('x').value;
var y = document.getElementById('y').value;
try {
var r = divide(x, y);
} catch(err) {
gtag('event', 'exception', {
'description': err,
'fatal': false
});
}
[[["समझने में आसान है","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"]],["आखिरी बार 2024-09-13 (UTC) को अपडेट किया गया."],[[["\u003cp\u003eGoogle Analytics can track website errors and crashes using exception events sent via gtag.js.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003egtag('event', 'exception', {<exception_parameters>})\u003c/code\u003e is the core function to send exception data, including an optional description and fatality status.\u003c/p\u003e\n"],["\u003cp\u003eAn example demonstrates how to capture and send exceptions occurring within a JavaScript \u003ccode\u003etry...catch\u003c/code\u003e block.\u003c/p\u003e\n"]]],["Exception events, used to track web page crashes and errors, are sent to Google Analytics via the `gtag('event', 'exception', {\u003cexception_parameters\u003e});` command. `\u003cexception_parameters\u003e` include 'description' (error details) and 'fatal' (boolean indicating if the error is fatal). When an error is detected, a `gtag` event can be sent. An example uses a `try...catch` block to intercept division-by-zero errors and trigger the `gtag` event.\n"],null,["# Measure exceptions\n\nYou can send exception events to measure the number and type of crashes or\nerrors that occur on a web page. This page describes how to use gtag.js to send\nexceptions to Google Analytics.\n\nImplementation\n--------------\n\nWhen an error occurs, send an exception event to Google Analytics: \n\n gtag('event', 'exception', {\u003cexception_parameters\u003e});\n\nwhere `\u003cexception_parameters\u003e` is one or more parameter-value pairs. Separate\neach pair by a comma. For example, this command sends a nonfatal error\nexception. \n\n gtag('event', 'exception', {\n 'description': 'error_description',\n 'fatal': false // set to true if the error is fatal\n });\n\nException parameters\n--------------------\n\nThe following table lists the exception parameters:\n\n| Parameter name | Data type | Required | Description |\n|----------------|-----------|----------|--------------------------------|\n| `description` | string | No | A description of the error. |\n| `fatal` | boolean | No | `true` if the error was fatal. |\n\nExample\n-------\n\nGiven the following function: \n\n function divide(x, y) {\n if (y === 0) {\n throw \"Division by zero\";\n }\n return x/y;\n }\n\nthe following code will send an exception event to Google Analytics if the\ndivisor y is zero: \n\n var x = document.getElementById('x').value;\n var y = document.getElementById('y').value;\n\n try {\n var r = divide(x, y);\n } catch(err) {\n gtag('event', 'exception', {\n 'description': err,\n 'fatal': false\n });\n }"]]