Back to Integrations

Express Integration

Add the Pulse script to your template engine's layout (EJS, Pug, Handlebars) or serve it via static HTML.


Method 1: EJS template

If you use EJS as your template engine, add the script to your layout with a production guard.

views/layout.ejs
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <% if (process.env.NODE_ENV === 'production') { %>
    <script
      defer
      data-domain="your-site.com"
      src="https://pulse.ciphera.net/script.js"
    ></script>
    <% } %>

    <title><%= title %></title>
</head>
<body>
    <%- body %>
</body>
</html>

Method 2: Static HTML

If you serve static HTML files via Express, add the script directly.

public/index.html
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <script
      defer
      data-domain="your-site.com"
      src="https://pulse.ciphera.net/script.js"
    ></script>

    <title>My Express App</title>
</head>
<body>
    <h1>Hello World</h1>
</body>
</html>

Related Integrations: Flask, Next.js, React