Pipedrive Deal Conversion Tracking to GA4/Google Ads via Measurement Protocol - n8n Workflow

Automatically send Pipedrive deal conversion data to GA4 and Google Ads using the Measurement Protocol. Leverage this n8n workflow for accurate revenue tracking.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Marketing teams needing precise ROI tracking from CRM data to Google Ads.

  • Sales Operations professionals looking to sync conversion metrics reliably.

  • Users searching for robust n8n templates to integrate Pipedrive and GA4.

  • Businesses requiring server-side conversion tracking via the GA4 Measurement Protocol.

Overview

Achieving accurate marketing attribution requires connecting sales outcomes from your CRM (like Pipedrive) directly to your analytics platform (like GA4). This specific n8n workflow solves the problem of data latency and browser-based tracking limitations by utilizing the GA4 Measurement Protocol.

When a Pipedrive deal reaches a 'Won' or target stage, this n8n automation extracts critical client identification data (like client_id) stored in Pipedrive. It then constructs a server-side event payload and sends it to Google Analytics. This ensures that revenue, transaction ID, and client context are accurately reflected in GA4, providing superior tracking for subsequent optimization in Google Ads. This robust n8n template utilizes core logic flow control to handle data verification steps, ensuring only valid conversions are reported.

How it Works

This comprehensive n8n workflow operates through several logical steps, starting with the dedicated n8n trigger:


  1. Trigger: The Pipedrive trigger monitors for updates to deal status (e.g., stage change or 'Won' status) within Pipedrive.

  2. Deal Retrieval: The workflow immediately uses a Pipedrive n8n node to retrieve the full details of the specific deal that triggered the event.

  3. Stage Verification: The n8n workflow retrieves all pipeline stages and filters them to confirm the deal has moved into the desired conversion stage. A subsequent ‘If’ n8n node confirms the correct stage transition.

  4. Contact Data Collection: If the stage is correct, the workflow fetches the associated 'Person' record from Pipedrive.

  5. Tracking ID Extraction: A key step involves an HTTP Request n8n node and a Code n8n node to fetch custom person fields and programmatically extract the stored GA4 clientid and check for marketing consent.

  6. Validation: An 'If' n8n node checks if the required clientid exists and if consent was granted before proceeding with external tracking.

  7. Payload Construction: The workflow uses another Code n8n node (Construct GA4 object) to format the deal data (value, currency, deal ID) into the specific JSON structure required by the GA4 Measurement Protocol.

  8. Final Submission: The final HTTP Request n8n node (HTTP Request — Send GA4) sends the formatted conversion data directly to the Google Analytics 4 Measurement Protocol endpoint, completing the n8n automation.

Installation Guide

To deploy this n8n workflow and begin sending conversion data:


  1. Import: Copy the provided JSON code and import it directly into your n8n instance using the 'New' -> 'Import from JSON' option.

  2. Credentials: You will need to configure the following credentials for the respective n8n node types:

Pipedrive Trigger/Node: Set up your Pipedrive API key credentials.
HTTP Request (Pipedrive API Calls): Ensure your Pipedrive API token is configured in the HTTP Request nodes to fetch field and stage data.
* HTTP Request (GA4): You must configure the GA4 Measurement ID and API Secret within the final 'HTTP Request — Send GA4' n8n node URL and body parameters.

  1. Pipedrive Setup: Ensure you have a custom field in Pipedrive (on the Person object) dedicated to storing the GA4 client ID (_ga). The Code n8n node depends on this custom field.

  2. Activation: Once all credentials and field mappings within the Code n8n node are verified, activate the Pipedrive trigger and the overall n8n workflow.

Node Details

Pipedrive Trigger: The initiating n8n trigger. It listens for specified deal changes in Pipedrive, kicking off the conversion tracking process.
Assign Variables (Set): Used early in the n8n workflow to capture and structure key data fields from the trigger output.
Get a deal (Pipedrive n8n node): Fetches comprehensive deal details, crucial for obtaining metrics like deal value and associated contact person ID.
get stages for pipeline (HTTP Request n8n node): Calls the Pipedrive API to retrieve stage definitions, allowing the n8n workflow to map deal stage IDs to readable names.
Filter/If correct stage name (Filter/If n8n node): Core logic steps that ensure the conversion event only proceeds if the deal has transitioned to the designated successful stage.
Get a person (Pipedrive n8n node): Retrieves the specific contact record, necessary for finding the clientid tracking data.
Get clientid and consentgranted (Code n8n node): This specialized n8n node runs JavaScript to iterate through custom person fields (obtained from Pipedrive) and extract the required GA4 clientid and tracking consent status.
If client_id exists and consent is given (If n8n node): A conditional n8n node that acts as a gatekeeper, preventing invalid GA4 hits by verifying the existence of the client identifier.
Construct GA4 object (Code n8n node): Formats the collected Pipedrive data into the JSON payload structure required for the GA4 Measurement Protocol event, typically logging a 'purchase' or 'conversion' event.
HTTP Request — Send GA4 (HTTP Request n8n node): The final action in this n8n workflow. It uses a POST request to send the structured conversion event payload directly to the Google Analytics 4 Measurement Protocol endpoint.

Related n8n Workflows

Paid

Nodes: 9 Nodes
Updated: December 26 2025
View all
Created by

Software Engineer & Automations Specialist

Featured*