npm package: @ovehbe/n8n-nodes-ads-conversions
Description: n8n community node for sending conversion events to Facebook (Meta) Conversions API and Google Ads Offline Conversions
Author: ovehbe
Latest version: 0.1.9

# n8n-nodes-ads-conversions

A community node for [n8n](https://n8n.io) that sends conversion events to **Facebook (Meta) Conversions API** and **Google Ads Offline Conversions** — with automatic PII hashing, just like Zapier's dedicated conversion nodes.

No more manually constructing JSON payloads, normalizing data, or SHA256-hashing fields. Fill in the form fields and the node handles the rest.

## Features

- **Facebook Conversions API (CAPI)**
  - Send Purchase, Lead, CompleteRegistration, or Custom events
  - All PII fields (email, phone, name, city, etc.) are **automatically normalized and SHA256-hashed**
  - Non-PII fields (fbc, fbp, IP, user agent) are passed through unhashed
  - Test Event Code support for validation in Events Manager
  - Data Processing Options (LDU) support

- **Google Ads Offline Conversions**
  - Upload click conversions with GCLID, GBRAID, or WBRAID
  - Enhanced conversions with **auto-hashed** user identifiers
  - Consent fields for ad user data and ad personalization
  - Partial failure handling

## Installation

### In n8n (Community Nodes)

1. Go to **Settings** → **Community Nodes**
2. Select **Install a community node**
3. Enter `n8n-nodes-ads-conversions`
4. Agree to the risks and click **Install**

### Manual Installation

```bash
cd ~/.n8n/custom
npm install n8n-nodes-ads-conversions
```

Then restart n8n.

### Development

```bash
git clone https://github.com/ovehbe/n8n-nodes-ads-conversions.git
cd n8n-nodes-ads-conversions
npm install --ignore-scripts
npm run build
```

To link for local development:
```bash
npm link
cd ~/.n8n
npm link n8n-nodes-ads-conversions
```

## Setup

### Facebook Conversions API

1. Create a **System User** in [Meta Business Manager](https://business.facebook.com/settings/system-users)
2. Generate an **Access Token** with `ads_management` permission
3. In n8n, create a new **Facebook Conversions API** credential with this token
4. Find your **Pixel ID** in Events Manager → Data Sources

### Google Ads OAuth2

1. Create an **OAuth2 application** in [Google Cloud Console](https://console.cloud.google.com/apis/credentials)
2. Enable the **Google Ads API** in your project
3. Get a **Developer Token** from your Google Ads Manager account → API Center
4. In n8n, create a new **Google Ads OAuth2 API** credential:
   - Client ID and Secret from GCP
   - Developer Token
   - (Optional) Login Customer ID if using an MCC

## Usage

### Facebook: Send Purchase Event

1. Add the **Ads Conversions** node to your workflow
2. Select **Facebook Conversions** as the resource
3. Choose **Send Purchase Event**
4. Fill in:
   - **Pixel ID** — your Facebook Pixel
   - **Action Source** — where the conversion happened (e.g. `website`)
   - **Event Time** — when it occurred
   - **User Data** — email, phone, name, etc. (auto-hashed)
   - **Purchase Data** — value, currency, content name

### Facebook: Send Lead Event

Same as above but select **Send Lead Event**. No purchase data needed.

### Google Ads: Send Offline Conversion

1. Select **Google Ads** as the resource
2. Choose **Send Offline Conversion**
3. Fill in:
   - **Customer ID** — your Google Ads account ID (no dashes)
   - **Conversion Action** — resource name from your account
   - **Conversion Date Time** — format: `yyyy-mm-dd hh:mm:ss+|-hh:mm`
   - **Click Identifiers** — GCLID from the ad click
   - **Consent** — GRANTED / DENIED for EU compliance
   - **Value** and **Currency**
   - **Enhanced Conversions** — email, phone, address (auto-hashed)

## How Auto-Hashing Works

The node automatically handles the data normalization and SHA256 hashing required by both platforms:

| Field | Normalization | Hashed? |
|-------|--------------|---------|
| Email | trim, lowercase | Yes |
| Phone | strip non-digits | Yes |
| First/Last Name | trim, lowercase | Yes |
| City | trim, lowercase, strip non-alpha | Yes |
| State | trim, lowercase | Yes |
| Zip | trim, lowercase, strip spaces/dashes | Yes |
| Country | trim, lowercase | Yes |
| Gender | first char, lowercase | Yes |
| Date of Birth | strip non-digits | Yes |
| External ID | — | Yes |
| fbc / fbp | — | No |
| Client IP / User Agent | — | No |

## API Versions

- Facebook Graph API: **v21.0**
- Google Ads API: **v19**

These are configured as constants in the source and easy to update.

## License

MIT