<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Mohamed Kadi</title>
    <description>The latest articles on DEV Community by Mohamed Kadi (@mohamedkadi).</description>
    <link>https://dev.to/mohamedkadi</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4263690%2F21b7040f-b6ab-4e36-b277-5395440f1be6.jpg</url>
      <title>DEV Community: Mohamed Kadi</title>
      <link>https://dev.to/mohamedkadi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mohamedkadi"/>
    <language>en</language>
    <item>
      <title>Stop Optimizing Google Ads for Form Fills: Send CRM Lead Stages Back as Offline Conversions</title>
      <dc:creator>Mohamed Kadi</dc:creator>
      <pubDate>Wed, 25 Nov 2026 02:41:32 +0000</pubDate>
      <link>https://dev.to/mohamedkadi/stop-optimizing-google-ads-for-form-fills-send-crm-lead-stages-back-as-offline-conversions-50</link>
      <guid>https://dev.to/mohamedkadi/stop-optimizing-google-ads-for-form-fills-send-crm-lead-stages-back-as-offline-conversions-50</guid>
      <description>&lt;p&gt;If you build lead forms for B2B companies, you've probably wired a conversion tag to the "thank you" page and moved on. Smart Bidding then does exactly what it's told: it finds people who like filling in forms. Whether they ever become customers is invisible to it.&lt;/p&gt;

&lt;p&gt;The fix is not a better form tag. It's sending what happens &lt;em&gt;after&lt;/em&gt; the form, in the CRM, back to Google Ads. Here's how I set that up as a developer, step by step.&lt;/p&gt;

&lt;h2&gt;
  
  
  The idea in one paragraph
&lt;/h2&gt;

&lt;p&gt;Store the click ID that brought each lead to the site. When the sales team moves that lead to "qualified", "proposal sent" or "won" in the CRM, send that event back to Google Ads as an offline conversion with the original click ID and the time it happened. Then make the later stages your primary conversions and demote the form submit to secondary.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Capture the click ID on landing
&lt;/h2&gt;

&lt;p&gt;Google Ads appends &lt;code&gt;gclid&lt;/code&gt; (and on iOS traffic sometimes &lt;code&gt;gbraid&lt;/code&gt; / &lt;code&gt;wbraid&lt;/code&gt;) to the landing URL when auto-tagging is on. Grab it on the first page view and keep it for the session, because the visitor often submits the form on a different page.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// on every page load&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;params&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;URLSearchParams&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;location&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;search&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;key&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"gclid"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"gbraid"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"wbraid"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;params&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// first-party storage; keep it ~90 days, matching the click window you use&lt;/span&gt;
    &lt;span class="n"&gt;localStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Respect consent: only store it if your consent setup allows ad storage for that visitor.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Send it with the form
&lt;/h2&gt;

&lt;p&gt;Add hidden fields and fill them just before submit:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="n"&gt;form&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"submit"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;key&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"gclid"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"gbraid"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"wbraid"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;raw&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;localStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;raw&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;form&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;elements&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;raw&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On the server, save these values on the lead record in the CRM, next to the email and phone number. If the click ID never reaches the CRM, nothing else in this guide works, so test this first.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Define stages the sales team actually uses
&lt;/h2&gt;

&lt;p&gt;Agree with sales on a short, fixed list of statuses, for example:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;CRM status&lt;/th&gt;
&lt;th&gt;Google Ads conversion action&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;New (form submitted)&lt;/td&gt;
&lt;td&gt;Lead – form (secondary)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Qualified&lt;/td&gt;
&lt;td&gt;Lead – qualified (primary)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Proposal sent&lt;/td&gt;
&lt;td&gt;Lead – proposal (primary or secondary)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Won&lt;/td&gt;
&lt;td&gt;Customer – won (primary, with value)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The key requirement: the status must be updated consistently, by people, in the CRM. If half the team never touches the status field, the data you send back is wrong and bidding learns from noise.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Create the conversion actions
&lt;/h2&gt;

&lt;p&gt;In Google Ads, create one conversion action per stage with the source set to import from clicks. Set the counting to "one" for lead stages. For "won", pass a value if you can, even an estimate per deal type, so value-based bidding has something to work with.&lt;/p&gt;

&lt;p&gt;Also turn on &lt;strong&gt;enhanced conversions for leads&lt;/strong&gt;. It lets Google match conversions using hashed email or phone when the click ID is missing, which happens more often than you'd think.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Push status changes back
&lt;/h2&gt;

&lt;p&gt;Whenever a lead's status changes in the CRM, queue an upload with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the click ID (&lt;code&gt;gclid&lt;/code&gt; / &lt;code&gt;gbraid&lt;/code&gt; / &lt;code&gt;wbraid&lt;/code&gt;),&lt;/li&gt;
&lt;li&gt;the conversion action for the new stage,&lt;/li&gt;
&lt;li&gt;the time of the status change, with timezone,&lt;/li&gt;
&lt;li&gt;the value and currency, if any,&lt;/li&gt;
&lt;li&gt;hashed email/phone for enhanced conversions.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can upload a scheduled CSV, use a CRM's built-in Google Ads integration, or call the Google Ads API's offline conversion upload from a small job. The API route is the most flexible: a webhook from the CRM on status change, a queue, and a worker that uploads in batches and logs every result.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CRM status change  -&amp;gt;  webhook  -&amp;gt;  queue  -&amp;gt;  upload worker  -&amp;gt;  Google Ads
                                                   |
                                                   +-&amp;gt; log: lead id, click id, action, status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Log every upload response. Rejected rows (expired click, unknown click ID, wrong time format) are the most common silent failure.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Switch the optimisation goal
&lt;/h2&gt;

&lt;p&gt;Once the qualified-lead conversions are flowing steadily, make "Lead – qualified" the primary conversion and set the form submit to secondary. Bidding now optimises for leads your sales team considers real, not for form fills.&lt;/p&gt;

&lt;p&gt;Don't switch on day one. Let the new conversions accumulate first, and change one campaign before all of them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Common mistakes I see
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Click ID lost between pages.&lt;/strong&gt; Stored only on the landing page, gone by the time the visitor reaches the contact page.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Status changes with the wrong time.&lt;/strong&gt; Uploading "now" instead of the moment the status actually changed, or forgetting the timezone.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Too many stages.&lt;/strong&gt; Six primary conversions confuse bidding. Two or three are enough.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No one owns the CRM statuses.&lt;/strong&gt; The pipeline only works if sales keeps them up to date.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No monitoring.&lt;/strong&gt; Compare the number of qualified leads in the CRM with the conversions Google Ads reports every week. A gap means uploads are failing.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Wrapping up
&lt;/h2&gt;

&lt;p&gt;The tracking code is the easy part: a few lines of JavaScript and a hidden field. The real work is agreeing on CRM stages and making sure the data flows back reliably. When it does, your campaigns stop chasing form fills and start chasing customers.&lt;/p&gt;

&lt;p&gt;If you'd rather not build this yourself, it's the kind of setup we handle as a &lt;a href="https://www.wmktechnologies.com/google-ads-agency" rel="noopener noreferrer"&gt;Google Ads agency&lt;/a&gt; that also builds the CRM side. Either way, start by checking whether the click ID actually reaches your CRM today. In my experience, that's where most setups break.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>marketing</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
