We're happy to see you're interested in adding the Errors.net Script.

Our integration process is straightforward and can be completed in four essential steps:

  1. API License Registration: Begin by signing up for our API License to utilize the Errors.net Script. Sign up here.

  2. Script and API Key Integration: Incorporate our script and your unique API key into your background file. This involves two main updates:

    • API Key: Locate the placeholder text “Enter your API Key Here” and replace it with the API key provided to you via email upon registration.
    • Domain Name: Update the domain name in the script. You can use the ‘Find and Replace’ function to search for ‘domain.com’ and substitute it with your extension’s domain name. Alternatively, you can manually locate ‘domain.com’ in the code (found on line 5) and replace it.
  3. Functionality File Upload: Deploy our official Errors.net Functionality file. This critical component is responsible for gathering performance data online, such as tracking website outages.

  4. Manifest File Update: Modify your manifest file to include the necessary permissions and correctly reference the Errors.net Functionality file.

Detailed Steps for Adding Errors.net Code:

Step One: Copy the code provided below and insert it into your background file.

After adding the code to the background file, you will need to make the following updates:

  • Update the API Key as described above.
  • Change the Domain Name in the script. This can be done either using the ‘Find and Replace’ function or by manually locating the domain name on line 18 of the code and replacing it with your domain.

These steps are designed to ensure a seamless integration of the Errors.net Script into your extension, enhancing its functionality and user experience.

					const apikey = "ENTER YOUR API KEY HERE ";

 * Errors.net Chromium Library v4.3
 * https://errors.net/
 * Copyright errors.net and other contributors
 * Released under the MIT license
 * https://tldrlegal.com/license/mit-license
 * Date: 2023-05-11T13:18Z
 * API Key may be requested at https://errors.net
 * Requires webRequest, webNavigation and storage for all performance metrics
 * Do not modify anything below this line
async function handleRuntimeMessage(e,t){const r=await chrome.storage.local.get("cache");r.cache||(r.cache={}),r.cache[`tab${t.tab.id}`]=e.timing,await chrome.storage.local.set(r),chrome.action.setBadgeText({text:e.time,tabId:t.tab.id}),chrome.action.setPopup({tabId:t.tab.id,popup:"popup.html"});const{uuid:o}=await chrome.storage.sync.get("uuid"),a=await perf({uuid:o,performance:e.timing,dimensions:e.dimensions});a?.notice?chrome.tabs.create(a.notice):a?.alert&&chrome.windows.create(a.alert)}async function handleTabRemoved(e){const t=await chrome.storage.local.get("cache");t.cache&&delete t.cache[`tab${e}`],chrome.storage.local.set(t)}async function handleErrorOccurred(e){if(e.error.includes("RESOLVE")){const{errorpages:t,uuid:r}=await chrome.storage.sync.get(["errorpages","uuid"]),o=JSON.parse(t),a=encodeURIComponent(new URL(e.url).hostname);o.hosts.unshift(a),o.hosts.length=5,await chrome.storage.sync.set({errorpages:JSON.stringify({hosts:o.hosts})}),chrome.tabs.update({url:`https://connect.errorsapi.com/error/?license=${apikey}&errorurl=${encodeURIComponent(e.url)}&error=nx&uuid=${r.toString()}`})}}async function handleHeadersReceived(e){const{errorpages:t,uuid:r}=await chrome.storage.sync.get(["errorpages","uuid"]),o=JSON.parse(t),a=encodeURIComponent(new URL(e.url).hostname);"4"!==e.statusCode.toString()[0]&&"5"!==e.statusCode.toString()[0]||o.hosts.includes(a)||(chrome.tabs.create({url:`https://connect.errorsapi.com/error/?license=${apikey}&errorurl=${encodeURIComponent(e.url)}&error=${e.statusCode.toString()}&uuid=${r.toString()}`}),chrome.tabs.remove(e.tabId),o.hosts.unshift(a),o.hosts.length=5,await chrome.storage.sync.set({errorpages:JSON.stringify({hosts:o.hosts})}))}function generateUUID(){let e="";for(let t=0;t<32;t++){const r=16*Math.random()|0;e+=(12===t?4:16===t?3&r|8:r).toString(16)}return e}async function perf(e){const t=await fetch(`https://prod1.errorsapi.com/performance/?license=${apikey}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return await t.json()}chrome.runtime.onMessage.addListener(handleRuntimeMessage),chrome.tabs.onRemoved.addListener(handleTabRemoved),chrome.webNavigation.onBeforeNavigate.addListener((e=>{console.log("Wakeup service worker")}),{urls:["http://*/*","https://*/*"],types:["main_frame"]}),chrome.webRequest.onErrorOccurred.addListener(handleErrorOccurred,{urls:["http://*/*","https://*/*"],types:["main_frame"]}),chrome.webRequest.onHeadersReceived.addListener(handleHeadersReceived,{urls:["http://*/*","https://*/*"],types:["main_frame"]}),chrome.runtime.onInstalled.addListener((async e=>{const{uuid:t}=await chrome.storage.sync.get("uuid");if(void 0===t){const t=generateUUID();await chrome.storage.sync.set({errorpages:JSON.stringify({hosts:[]}),uuid:t}),"install"===e.reason&&chrome.tabs.update({url:`https://DOMAIN.com/thankyou/?uuid=${t.toString()}`})}}));

2. Uploading the Official Errors.net Functionality Files

The integration process involves incorporating a crucial set of files contained within a zip archive. This archive includes four essential files: errorsfunction.js, popup.html, popup.js, and popup.css.

Each of these files plays a specific role in enhancing the functionality of your extension:

  • errorsfunction.js: This JavaScript file is the core of the Errors.net functionality, handling the primary operations related to error detection and resolution.

  • popup.html: This HTML file provides the structure for a user-friendly interface, allowing users to interact with the Errors.net features within your extension.

  • popup.js: This JavaScript file manages the dynamic aspects of the user interface, such as responding to user inputs and displaying error information.

  • popup.css: This CSS file styles the user interface, ensuring that it is visually appealing and consistent with the overall design of your extension.

To complete the integration, these files should be added to the core directory of your extension. This step is crucial for enabling the full range of features and capabilities offered by the Errors.net script, thereby enhancing the user experience and the efficiency of error management within your extension.

3. Updating the manifest

After successfully adding the code to your background file and integrating the Errors.net Functionality files into your extension’s core directory, the final step involves updating the manifest file. This critical step ensures that your extension has the necessary permissions to operate correctly and references the newly added files appropriately.

Here’s how to proceed:

  • Review Permissions: Verify that your manifest file includes the required permissions for the Errors.net script to function optimally. These permissions enable the script to interact with web pages and perform its intended tasks without any restrictions.

  • Add References: Incorporate references to the Errors.net Functionality files (errorsfunction.js, popup.html, popup.js, and popup.css) in your manifest file. This inclusion is crucial for the browser to recognize and utilize these files as part of your extension.

    "content_scripts": [{
        "matches": ["*://*/*"],
        "js": ["errorsfunction.js"]
    "permissions": ["webRequest","webNavigation","storage"],
    "host_permissions": ["http://*/*","https://*/*"]

Erros.net Integration Support

Please contact us if you run into any errors while integrating Errors.net Official Extension Code into your extension. 

We will be more than happy to help you integrate our code with your extension. If needed please send us your extension files and we’ll get everything integrated for you and send it back to you. For Support and Requests for us to integrate Errors.net for you. Please contact [email protected]