Developer
SignupCops SDK
Call identifyUser when a signup completes. Optionally verify the email server-side to block disposable and high-risk signups before you accept them. For what SignupCops is and why, see the product page.
Track the signup
Call identifyUser the moment a signup completes, with the user's email. This works for every signup path: email and password forms, and Sign in with Google or any OAuth. Pick your stack:
// Identify the user as soon as their email is known.
// Works on any page: login, signup, checkout, profile, and more.
window.dcutils.identifyUser("[email protected]");
// Optionally pass a user ID from your own system
window.dcutils.identifyUser("[email protected]", "usr_123abc"); import { useEffect } from "react";
function LoginPage() {
const handleLogin = async (email) => {
// ... your auth logic ...
// Identify the user after a successful login
if (window.dcutils) {
await window.dcutils.identifyUser(email);
}
};
return <form onSubmit={...}>...</form>;
} // app/login/page.tsx (Next.js App Router)
"use client";
export default function LoginPage() {
const handleSubmit = async (formData) => {
const email = formData.get("email");
// ... your auth logic ...
// Identify the user, works client-side only
if (typeof window !== "undefined" && window.dcutils) {
await window.dcutils.identifyUser(email);
}
};
return <form action={handleSubmit}>...</form>;
} This needs the DataCops script on your site. If it is not there yet, add this one line in your <head>, using your public key from Settings, API Keys.
<script id="datacops_script"
src="https://cdn.joindatacops.com/script?cop_key=YOUR_COP_KEY" async></script> Verify
Trigger a login or signup on your site. The user's email appears in your dashboard within seconds. identifyUser is safe to call more than once. The same email is only stored once.
Before you go live
Consent
Only call identifyUser after the user has accepted your Terms and Privacy Policy. Their acceptance is the legal basis for using their email for ads. Make sure:
- Your signup form links to your Terms and Privacy Policy.
- The user actively accepts. No pre-ticked box.
- You call identifyUser only after they accept, usually right after signup completes.
- For EU or UK traffic, your consent banner covers ad and analytics purposes.
Optional: the same email runs through DataCops fraud scoring. You can hold flagged signups back from your ad platforms so campaigns only learn from real users, and the full fraud and identity data stays in your dashboard. This is off by default for delivery.
Get user data (server SDK)
Use @datacops/services-sdk to query risk scores, disposable email detection, and linked accounts from your backend, so you can block bad signups before you accept them.
1. Install the SDK
# npm
npm install @datacops/services-sdk
# yarn
yarn add @datacops/services-sdk
# pnpm
pnpm add @datacops/services-sdk 2. Get your private API key
Create a key of type Private or Secret in Settings, API Keys, then store it as DATACOPS_PRIVATE_KEY in your environment.
3. Initialise the SDK
import { DCServiceSdk } from "@datacops/services-sdk";
// Initialise once and reuse across your app.
// Your private key is available in Settings, API Keys.
const sdk = new DCServiceSdk({
apiKey: process.env.DATACOPS_PRIVATE_KEY, // keep this server-side only
}); 4. Check an email
const result = await sdk.checkEmail("[email protected]");
// result.emailInfo live risk analysis
console.log(result.emailInfo?.risk_label); // "low" | "medium" | "high" | "critical"
console.log(result.emailInfo?.risk_score); // 0 to 100
console.log(result.emailInfo?.disposable); // true if throw-away email
console.log(result.emailInfo?.free_provider); // true if Gmail, Yahoo, etc.
// result.userInfo identity record (null if not yet identified)
console.log(result.userInfo?.related_emails); // other emails on same device
console.log(result.userInfo?.related_email_count); // total emails for that device
console.log(result.userInfo?.deviceFingerprint); // device fingerprint object 5. Block risky signups
async function handleSignup(email) {
const result = await sdk.checkEmail(email);
if (result.emailInfo?.disposable) {
throw new Error("Disposable email addresses are not allowed.");
}
if ((result.emailInfo?.risk_score ?? 0) >= 75) {
await flagForReview(email, result.emailInfo);
}
// Proceed with signup...
} 6. Full Express example
import express from "express";
import { DCServiceSdk } from "@datacops/services-sdk";
const sdk = new DCServiceSdk({ apiKey: process.env.DATACOPS_PRIVATE_KEY });
const app = express();
app.post("/api/signup", async (req, res) => {
const { email } = req.body;
const { emailInfo } = await sdk.checkEmail(email);
if (emailInfo?.disposable) {
return res.status(400).json({ error: "Disposable emails are not accepted." });
}
// ... create user account ...
res.json({ success: true });
}); Response reference
| Field | Type | Description |
|---|---|---|
| emailInfo.risk_label | string | "low" | "medium" | "high" | "critical" |
| emailInfo.risk_score | number | 0 to 100 risk score |
| emailInfo.disposable | boolean | True if this is a throwaway address |
| emailInfo.free_provider | boolean | True if Gmail, Yahoo, etc. |
| emailInfo.domain | string | The email domain |
| userInfo.related_emails | string[] | Other emails on the same device |
| userInfo.related_email_count | number | Total unique emails for that device |
| userInfo.deviceFingerprint | object | null | Device fingerprint data |
- Requires Node.js 18 or later (uses native fetch).
- All requests are server-to-server. Your private key is never exposed to the browser.
- checkEmail throws typed errors: DCServiceError, DCServiceTimeoutError.
- userInfo is null if identifyUser was never called for this email.