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 what you already know. Every field is optional.
window.dcutils.identifyUser("[email protected]", {
externalId: "usr_123abc", // your own user id
firstName: "Ada",
lastName: "Lovelace",
phone: "+15551234567",
country: "GB",
signupMethod: "email", // or "google", "apple", "phone"
value: 25, // what this signup is worth to you
currency: "GBP",
}); 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. Repeat calls for the same email add new details and never wipe ones already stored.
The extra details (name, phone, address fields, your user id, value) improve how well ad platforms match the signup when DataCops sends it as a conversion. Map the signup event in the Event Manager to choose where it goes.
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.
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.action); // "ALLOW" | "CHALLENGE" | "BLOCK"
console.log(result.emailInfo.risk_label); // "low" | "medium" | "high" | "critical"
console.log(result.emailInfo.risk_score); // 0 to 100
console.log(result.emailInfo.reasons); // why, in plain words
console.log(result.emailInfo.fraud_signals.disposable_domain); // throw-away email
console.log(result.emailInfo.fraud_signals.identity_flags.free_provider); // 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.action === "BLOCK") {
throw new Error("Signup rejected: " + result.emailInfo.reasons.join(", "));
}
if (result.emailInfo.action === "CHALLENGE") {
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.fraud_signals.disposable_domain) {
return res.status(400).json({ error: "Disposable emails are not accepted." });
}
// ... create user account ...
res.json({ success: true });
}); Response reference
| Field | Type | Description |
|---|---|---|
| emailInfo.action | string | "ALLOW" | "CHALLENGE" | "BLOCK", the verdict to act on |
| emailInfo.reasons | string[] | Why, in plain words |
| emailInfo.risk_label | string | "low" | "medium" | "high" | "critical" |
| emailInfo.risk_score | number | 0 to 100 risk score |
| emailInfo.fraud_signals.disposable_domain | boolean | True if this is a throwaway address |
| emailInfo.fraud_signals.identity_flags.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: DCServiceValidationError, DCServiceError, DCServiceTimeoutError, DCServiceAbortError, DCServiceNetworkError.
- The first 500 checks per website are free. On the Free plan that is the limit (429 after); on Business and Organization extra checks cost $9.50 per 500.
- Full field list and the raw HTTP call: Email risk SDK.
- userInfo is null if identifyUser was never called for this email.