Embed Code Documentation
Important
Please replace XXXXXXX with your appID found in embed code snippet under the Settings > Applications > EmbedCode
Embed the Code
Use the following script to integrate Error Pulse for error tracking in your project:
<script data-errorpulse="XXXXXXX" src="https://asset.errorpulse.io/collector.js"></script>
Vanilla JavaScript
Add the script directly to your HTML file, preferably in the head
section:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Your Project</title>
<script data-errorpulse="XXXXXXX" src="https://asset.errorpulse.io/collector.js"></script>
</head>
<body>
<!-- Your content -->
</body>
</html>
WordPress
- Log in to your WordPress admin dashboard.
- Navigate to Appearance > Theme Editor.
- Open
header.php
or use a plugin to inject code snippets. - Paste the script before the closing
</head>
tag:
<script data-errorpulse="XXXXXXX" src="https://asset.errorpulse.io/collector.js"></script>
React
Option 1: Modify public/index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>React App</title>
<script data-errorpulse="XXXXXXX" src="https://asset.errorpulse.io/collector.js"></script>
</head>
<body>
<div id="root"></div>
</body>
</html>
Option 2: Use useEffect
in App.js
import { useEffect } from 'react';
function App() {
useEffect(() => {
const script = document.createElement('script');
script.setAttribute('data-errorpulse', 'XXXXXXX');
script.src = 'https://asset.errorpulse.io/collector.js';
document.head.appendChild(script);
}, []);
return <div>Your React App</div>;
}
export default App;
Next.js
For Next.js, add the script in pages/_document.js
:
import Document, { Html, Head, Main, NextScript } from 'next/document';
class MyDocument extends Document {
render() {
return (
<Html>
<Head>
<script
data-errorpulse="XXXXXXX"
src="https://asset.errorpulse.io/collector.js"
></script>
</Head>
<body>
<Main />
<NextScript />
</body>
</Html>
);
}
}
export default MyDocument;
Additional Frameworks
- Vue.js: Add the script in
public/index.html
or use a lifecycle hook. - Angular: Add the script in
src/index.html
. - Svelte: Include the script in
public/index.html
.
For any specific instructions or integrations, refer to the respective frameworkâs documentation or write us to support@errorpulse.io