### Set Initial Meta Robots Tag (JavaScript) Source: https://ngrx.io/docs/index This script dynamically creates and appends a meta tag with the name 'robots' and content 'noindex' to the document's head. This is intended as a temporary measure, with the tag expected to be removed later when the page content is ready and validated. ```javascript var tag = document.createElement('meta'); tag.name = 'robots'; tag.content = 'noindex'; document.head.appendChild(tag); ``` -------------------------------- ### Configure Google Analytics Tracking (JavaScript) Source: https://ngrx.io/docs/index This snippet configures Google Analytics for tracking website usage. It dynamically loads the analytics script and defines a global function `ga` for sending data. It includes a check to prevent loading during e2e tests. ```javascript window.ga = window.ga || function(){ (window.ga.q = window.ga.q || []).push(arguments) }; window.ga.l = 1*new Date(); var script = document.createElement('script'); var firstScript = document.getElementsByTagName('script')[0]; script.async = 1; script.src = 'https://www.google-analytics.com/analytics.js'; // only load library if not running e2e tests if (!~window.name.indexOf('NG_DEFER_BOOTSTRAP')) { firstScript.parentNode.insertBefore(script, firstScript); } ``` -------------------------------- ### Error Reporting to Google Analytics (JavaScript) Source: https://ngrx.io/docs/index This JavaScript code sets up a global error handler (`window.onerror`) to capture and report unhandled exceptions to Google Analytics. It formats the error details, including stack traces, to provide a concise description for reporting. ```javascript window.onerror = function() { ga('send', 'exception', {exDescription: formatError.apply(null, arguments), exFatal: true}); function formatError(msg, url, line, col, e) { var stack; msg = msg.replace(/^Error: /, ''); if (e) { stack = e.stack // strip the leading "Error: " from the stack trace .replace(/^Error: /, '') // strip the message from the stack trace, if present .replace(msg + '\n', '') // strip leading spaces .replace(/^ +/gm, '') // strip all leading "at " for each frame .replace(/^at /gm, '') // replace long urls with just the last segment: `filename:line:column` .replace(/(?: \(|@)http.+\/([^/)]+)\)?(?:\n|$)/gm, '@$1\n') // replace "eval code" in Edge .replace(/ *\(eval code(:\d+:\d+)\)(?:\n|$)/gm, '@???$1\n') } else { line = line || '?'; col = col || '?'; stack = url + ':' + line + ':' + col; } return (msg + '\n' + stack).substring(0, 150); } }; ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.