← ナレッジ一覧へ戻る

GoHighLevel:GoHighLevel(GHL)向け OpenAI Ads ピクセル&CAPI完全導入設定ガイド

GoHighLevel(GHL)向けOpenAI Adsトラッキング実装。Headトラッキングコード埋め込み、Workflow Webhook連携、予約・注文計測。

2026-04-09 • Funnel Builders & Landing Page Platforms

GoHighLevel powers sales and marketing infrastructure for service businesses and digital agencies.

Handling multi-step survey funnels, appointment calendars, and checkout forms inside GoHighLevel introduces tracking hurdles. Embeds often render within iframes, and mobile redirects can drop URL attribution parameters before booking confirmations load.

Optimizing advertising spend based solely on link clicks can waste budget on unqualified traffic.

A more effective architecture connects GoHighLevel tracking code settings directly with GHL Workflow Automations. The browser pixel tracks user engagement on landing pages, while a GHL Workflow triggers a webhook on form submission or appointment confirmation to transmit verified, hashed CAPI data to OpenAI.

Here is how to implement full hybrid tracking for leads and booked appointments in GoHighLevel.

Adding the pixel to GoHighLevel funnels

Place the base measurement script across your funnels or websites:

  1. In your GoHighLevel sub-account, open Sites, then Funnels or Websites.
  2. Select your target funnel and open the Settings tab.
  3. In the Head Tracking Code field, insert the measurement snippet:

<script>
  !function(w,d,e,u,t,s){if(w.openaiAds)return;t=w.openaiAds=function(){
  t.callMethod?t.callMethod.apply(t,arguments):t.queue.push(arguments)};
  if(!w._openaiAds)w._openaiAds=t;t.push=t;t.loaded=!0;t.version='1.0';
  t.queue=[];s=d.createElement(e);s.async=!0;s.src=u;
  var f=d.getElementsByTagName(e)[0];f.parentNode.insertBefore(s,f);
  }(window,document,'script','https://bzrcdn.openai.com/pixel.js');

  openaiAds('init', 'YOUR_PIXEL_ID');
  openaiAds('track', 'PageView');
</script>
<noscript>
  <img height="1" width="1" style="display:none" 
       src="https://bzr.openai.com/v1/events?pixel_id=YOUR_PIXEL_ID&event=PageView&noscript=1" />
</noscript>
  1. Save your settings to update all funnel steps.

Form and calendar postMessage listeners

To track conversions when visitors fill out forms or schedule calls, add this listener into Body Tracking Code:

<script>
  window.addEventListener('message', function (event) {
    if (event.data && (event.data.type === 'form-submitted' || event.data.action === 'form-submitted')) {
      var dedupeId = 'ghl_lead_' + (event.data.id || Date.now());
      if (window.openaiAds) {
        window.openaiAds('track', 'Lead', {
          content_name: 'GHL Form Submission'
        }, {
          event_id: dedupeId
        });
      }
    }

    if (event.data && (event.data.type === 'booking-completed' || event.data.action === 'booking-completed')) {
      var scheduleDedupeId = 'ghl_sched_' + (event.data.appointmentId || Date.now());
      if (window.openaiAds) {
        window.openaiAds('track', 'Schedule', {
          content_name: 'GHL Calendar Booking'
        }, {
          event_id: scheduleDedupeId
        });
      }
    }
  });
</script>

Server-side CAPI via GoHighLevel workflows

GoHighLevel Workflows allow you to trigger webhooks when forms are submitted or appointments are scheduled.

Because OpenAI Ads CAPI requires lowercased, trimmed SHA-256 hashed customer identifiers, route the GHL webhook to an edge worker relay:

Create the GHL Automation Workflow:

  1. Open Automation, select Workflows, and click Create Workflow.
  2. Set the trigger to Form Submitted or Appointment Status: Confirmed.
  3. Add a Webhook action set to POST pointing to your edge relay URL.
  4. Save and publish the workflow.

Deploy the edge relay function:

export default {
  async fetch(request, env) {
    if (request.method !== 'POST') {
      return new Response('Method Not Allowed', { status: 405 });
    }

    try {
      const ghlData = await request.json();
      const contact = ghlData.contact || ghlData;

      if (!contact || (!contact.email && !contact.phone)) {
        return new Response('Missing contact identifiers', { status: 400 });
      }

      const contactId = contact.id || Date.now().toString();
      const dedupeId = `ghl_lead_${contactId}`;

      const hashSha256 = async (str) => {
        if (!str) return null;
        const buf = new TextEncoder().encode(str.trim().toLowerCase());
        const hash = await crypto.subtle.digest('SHA-256', buf);
        return Array.from(new Uint8Array(hash)).map(b => b.toString(16).padStart(2, '0')).join('');
      };

      const hashedEmail = await hashSha256(contact.email);
      const hashedPhone = contact.phone ? await hashSha256(contact.phone.replace(/[^0-9]/g, '')) : null;

      let eventName = 'Lead';
      if (ghlData.appointment) eventName = 'Schedule';
      if (ghlData.order) eventName = 'Purchase';

      const payload = {
        data: [
          {
            event_name: eventName,
            event_time: Math.floor(Date.now() / 1000),
            event_id: dedupeId,
            user_data: {
              ...(hashedEmail && { em: hashedEmail }),
              ...(hashedPhone && { ph: hashedPhone }),
              ...(contact.country && { country: await hashSha256(contact.country) })
            },
            custom_data: {
              content_name: ghlData.workflow_name || 'GHL Conversion'
            },
            action_source: 'system_generated'
          }
        ]
      };

      const res = await fetch('https://bzr.openai.com/v1/events', {
        method: 'POST',
        headers: {
          'Authorization': `Bearer ${env.OPENAI_ADS_ACCESS_TOKEN}`,
          'Content-Type': 'application/json'
        },
        body: JSON.stringify(payload)
      });

      return new Response('Success', { status: res.status });
    } catch (err) {
      return new Response('Internal Server Error: ' + err.message, { status: 500 });
    }
  }
};

Verification checklist

Submit a test inquiry form and review Execution Logs inside GoHighLevel Automation to confirm the webhook executed with HTTP 200.

Check server logs to verify customer details were normalized and converted to 64-character hex SHA-256 strings before transmission.

Inspect OpenAI Ads Event Manager to confirm that browser and workflow events merge without duplicating conversion counts.

Frequently asked questions

Where is tracking code configured in GoHighLevel?

Open Sites, select Funnels or Websites, choose your funnel, open Settings, and paste the code into the Head Tracking Code input.

How do I send CAPI events from GHL Workflows?

Create a Workflow with a Form Submitted or Appointment Status trigger, then add a Webhook action directed to an edge function that hashes customer data and posts to OpenAI.

How do I track scheduled appointments in GHL?

Trigger your Workflow when appointment status changes to Confirmed, sending a Schedule event through the Conversions API.

How are duplicate events resolved between funnels and workflows?

Both the client postMessage handler and the server workflow use the contact identifier or appointment ID to generate a consistent event_id.

ChatGPT Ads の計測環境を構築しませんか?

設定・検証・仕様書をワンストップで提供。