> ## Documentation Index
> Fetch the complete documentation index at: https://docs.base44.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Build Google Ads tracking fix prompt

> <Info>This API is in beta. Endpoints, fields, and behavior may still change, so avoid depending on it in production.</Info>

Creates the app's Google Ads conversion goals if it does not have them, then returns an instruction that tells the AI how to install conversion tracking in the app.

Send the returned `composer_prompt` to [Send chat message](/api-reference/send-chat-message) and the AI does the wiring for you. Publish the app afterwards, because Google Ads only records conversions from the published app. Pair it with [Scan Google Ads conversion tracking](/api-reference/scan-google-ads-conversion-tracking) to see what needs fixing first.

This call changes the Google Ads account. Any goal missing from the standard set is created on it, covering `PURCHASE`, `ADD_TO_CART`, `BEGIN_CHECKOUT`, `SIGNUP`, `SUBMIT_LEAD_FORM`, `CONTACT`, `REQUEST_QUOTE`, `BOOK_APPOINTMENT`, `SUBSCRIBE_PAID`, and `PHONE_CALL_LEAD`. Creating a goal is not reversible through this API. Read [List Google Ads conversion actions](/api-reference/list-google-ads-conversion-actions) first if you want to know what the account already has.

Send `wire_events` as `true` to get a prompt that also wires each of the account's enabled [conversion mappings](/api-reference/list-google-ads-conversion-mappings), instead of only installing the base tag. On an account that has enabled mappings, that path waits for Google to publish the tag for each mapped goal and retries the read up to four times about a second apart, so the request can take several seconds.

If you write the app's code yourself instead of through the chat, read `tracking_snippet` and `conversions` rather than parsing the prompt. Install `tracking_snippet` once, then fire each entry's `send_to` where its action succeeds, and publish.

<Note>The conversion ID belongs to the app's Google Ads account, and only a launch creates that account. Before the first launch this call returns `skipped_reason` set to `no_google_ads_account` and a `next_step`. Launch first. Campaigns launched before tracking is verified start paused. Then call this again, install the snippet and the conversion calls, and publish. The campaigns resume on their own once the published app carries one of the returned `send_to` values.</Note>

<Note>Only `wire_events` is supported in the body. The builder UI sends a snapshot of the app's source alongside it, which is internal and not part of this API.</Note>

<Note>This endpoint accepts a personal API key or a workspace API key. A workspace API key acts as the workspace owner.</Note>



## OpenAPI

````yaml /developers/references/app-management/app-management-openapi.json post /api/apps/{app_id}/google-ads/tracking-scan/build-bootstrap-prompt
openapi: 3.1.0
info:
  title: Base44 App Management API
  version: 1.0.0
servers:
  - url: https://app.base44.com
security:
  - PersonalAccessTokenAuth: []
paths:
  /api/apps/{app_id}/google-ads/tracking-scan/build-bootstrap-prompt:
    post:
      summary: Build Google Ads tracking fix prompt
      description: >-
        <Info>This API is in beta. Endpoints, fields, and behavior may still
        change, so avoid depending on it in production.</Info>


        Creates the app's Google Ads conversion goals if it does not have them,
        then returns an instruction that tells the AI how to install conversion
        tracking in the app.


        Send the returned `composer_prompt` to [Send chat
        message](/api-reference/send-chat-message) and the AI does the wiring
        for you. Publish the app afterwards, because Google Ads only records
        conversions from the published app. Pair it with [Scan Google Ads
        conversion tracking](/api-reference/scan-google-ads-conversion-tracking)
        to see what needs fixing first.


        This call changes the Google Ads account. Any goal missing from the
        standard set is created on it, covering `PURCHASE`, `ADD_TO_CART`,
        `BEGIN_CHECKOUT`, `SIGNUP`, `SUBMIT_LEAD_FORM`, `CONTACT`,
        `REQUEST_QUOTE`, `BOOK_APPOINTMENT`, `SUBSCRIBE_PAID`, and
        `PHONE_CALL_LEAD`. Creating a goal is not reversible through this API.
        Read [List Google Ads conversion
        actions](/api-reference/list-google-ads-conversion-actions) first if you
        want to know what the account already has.


        Send `wire_events` as `true` to get a prompt that also wires each of the
        account's enabled [conversion
        mappings](/api-reference/list-google-ads-conversion-mappings), instead
        of only installing the base tag. On an account that has enabled
        mappings, that path waits for Google to publish the tag for each mapped
        goal and retries the read up to four times about a second apart, so the
        request can take several seconds.


        If you write the app's code yourself instead of through the chat, read
        `tracking_snippet` and `conversions` rather than parsing the prompt.
        Install `tracking_snippet` once, then fire each entry's `send_to` where
        its action succeeds, and publish.


        <Note>The conversion ID belongs to the app's Google Ads account, and
        only a launch creates that account. Before the first launch this call
        returns `skipped_reason` set to `no_google_ads_account` and a
        `next_step`. Launch first. Campaigns launched before tracking is
        verified start paused. Then call this again, install the snippet and the
        conversion calls, and publish. The campaigns resume on their own once
        the published app carries one of the returned `send_to` values.</Note>


        <Note>Only `wire_events` is supported in the body. The builder UI sends
        a snapshot of the app's source alongside it, which is internal and not
        part of this API.</Note>


        <Note>This endpoint accepts a personal API key or a workspace API key. A
        workspace API key acts as the workspace owner.</Note>
      operationId: >-
        build_bootstrap_prompt_api_apps__app_id__google_ads_tracking_scan_build_bootstrap_prompt_post
      parameters:
        - name: app_id
          in: path
          required: true
          schema:
            type: string
            description: >-
              ID of the app whose Google Ads conversion tracking you want to
              manage.
            title: App Id
          description: >-
            ID of the app whose Google Ads conversion tracking you want to
            manage.
          example: 6820f3a4e7b91d003c45a1f2
      requestBody:
        content:
          application/json:
            schema:
              title: BuildTrackingFixPrompt
              type: object
              properties:
                wire_events:
                  type: boolean
                  description: >-
                    Whether the prompt should also wire the account's enabled
                    conversion mappings (`true`) or only install the base tag
                    (`false`).
                  default: false
                  example: true
            example:
              wire_events: true
      responses:
        '200':
          description: The prompt to send to the AI.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TrackingFixPromptResponse'
        '401':
          description: Missing or invalid credentials.
        '403':
          description: >-
            You don't have access to this app or the app does not exist. A
            missing app and an app you cannot reach are deliberately the same
            answer. Marketing setup, campaign edits, generation and resuming
            also return `app_marketing_not_allowed` when the app's owning
            workspace has the FERPA designation. Historical reads, pausing,
            deletion and financial settlement remain available.
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '429':
          description: >-
            `rate_limited`: The base limit is 300 requests in a minute from your
            account, shared across every Google Ads write that doesn't name its
            own limit. Some workspaces have a higher limit. `X-RateLimit-Limit`
            reports the enforced limit. Retry after `Retry-After` seconds. The
            `X-RateLimit-*` headers report the budget left.
          content:
            application/json:
              examples:
                rate_limited:
                  summary: rate_limited
                  value:
                    error:
                      code: rate_limited
                      message: Rate limit exceeded.
                      details: {}
              schema:
                $ref: '#/components/schemas/StandardErrorEnvelope'
        '503':
          description: >-
            Database temporarily unavailable (`database_unavailable`): the data
            cluster did not answer in time. Retry after the `Retry-After`
            seconds.
          headers:
            Retry-After:
              description: Seconds to wait before retrying.
              schema:
                type: integer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StandardErrorEnvelope'
              examples:
                database_unavailable:
                  summary: database_unavailable
                  value:
                    error:
                      code: database_unavailable
                      message: Database temporarily unavailable, please retry
                      details: {}
      security:
        - PersonalAccessTokenAuth:
            - full_access
        - WorkspaceApiKeyAuth:
            - full_access
        - WorkspaceApiKeyBearerAuth:
            - full_access
components:
  schemas:
    TrackingFixPromptResponse:
      properties:
        composer_prompt:
          type: string
          title: Composer Prompt
          description: >-
            The instruction to send to [Send chat
            message](/api-reference/send-chat-message). It ends with a reminder
            to publish, because Google Ads only records conversions from the
            published app. The value is an empty string when `skipped_reason` is
            set.
          example: |-
            Wire up Google Ads conversion tracking for this app.

            Call get_capability_guide("google_ads") first, then follow it.
        conversion_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Conversion Id
          description: >-
            The gtag conversion ID baked into the prompt, or an empty string
            when the prompt tells the AI to look each one up instead of carrying
            a concrete ID. Absent when `skipped_reason` is set.
          example: AW-123456789
        actions_created_or_existing:
          anyOf:
            - type: integer
            - type: 'null'
          title: Actions Created Or Existing
          description: >-
            How many conversion goals the account has after this call, counting
            the ones it already had. Absent when `skipped_reason` is set.
          example: 10
        wired_mappings:
          anyOf:
            - type: integer
            - type: 'null'
          title: Wired Mappings
          description: >-
            How many of the account's conversion mappings the prompt carries
            wiring guidance for. When you send `wire_events` and the account has
            no enabled mapping, this reports the number of conversion categories
            the prompt offers instead, so read any value above `0` as a sign
            that the prompt carries wiring guidance rather than as a mapping
            count. Absent when `skipped_reason` is set.
          example: 3
        skipped_reason:
          anyOf:
            - type: string
            - type: 'null'
          title: Skipped Reason
          description: >-
            Why no prompt was produced. The only value is
            `no_google_ads_account`, which means the app has no Google Ads
            account that can carry conversion tracking. The field is absent
            whenever a prompt was produced.
          example: no_google_ads_account
        next_step:
          anyOf:
            - type: string
            - type: 'null'
          title: Next Step
          description: >-
            Present only with `skipped_reason`. What to do next, in plain words.
            When the app has no account yet it points to [Create Google Ads
            account for
            tracking](/api-reference/create-google-ads-account-for-tracking),
            which creates the account the conversion ID belongs to without
            launching anything. When the account exists but is held, for example
            on billing, it names the account's status instead.
          example: >-
            Create the Google Ads account first with POST
            /accounts/ensure-for-tracking (no campaign, nothing charged), then
            call this again.
        tracking_snippet:
          anyOf:
            - type: string
            - type: 'null'
          title: Tracking Snippet
          description: >-
            The gtag bootstrap to install in the app, as plain JavaScript. Use
            this one, not the snippet from [Get Google Ads tracking
            script](/api-reference/get-google-ads-tracking-script): it is the
            same bootstrap `composer_prompt` installs. Put it at module scope at
            the top of the app's root file, outside any component and not inside
            a `useEffect`, so `window.gtag` exists before a page fires a
            conversion. When the app owner chose to track visitors only after
            consent, it starts every consent type as denied and the app needs a
            consent banner that sends `gtag('consent', 'update', ...)`. An empty
            string when no conversion ID is available yet, which is usually the
            case for `wire_events` set to `true` on an account with no enabled
            mapping, so send `false` there. Absent when `skipped_reason` is set.
          example: |-
            if (typeof document !== 'undefined' && !window.__gads_loaded) {
                window.__gads_loaded = true;
                ...
                window.gtag('config', 'AW-123456789', { send_page_view: false });
            }
        conversions:
          anyOf:
            - items:
                $ref: '#/components/schemas/TrackingConversionCall'
              type: array
            - type: 'null'
          title: Conversions
          description: >-
            One entry per enabled [conversion
            mapping](/api-reference/list-google-ads-conversion-mappings) whose
            goal has a published tag, with the exact `send_to` to fire. A
            mapping whose tag Google has not published yet is left out, so call
            again shortly if one is missing. Empty when the account has no
            enabled mapping: create one, or fire
            `conversion_id/conversion_label` from [List Google Ads conversion
            actions](/api-reference/list-google-ads-conversion-actions). Absent
            when `skipped_reason` is set.
      type: object
      required:
        - composer_prompt
      title: TrackingFixPromptResponse
      description: A ready-made instruction for the AI to install conversion tracking.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    StandardErrorEnvelope:
      properties:
        error:
          $ref: '#/components/schemas/StandardError'
          description: What went wrong.
      type: object
      required:
        - error
      title: StandardErrorEnvelope
      description: The error body returned in the standard envelope.
    TrackingConversionCall:
      properties:
        mapping_id:
          type: string
          title: Mapping Id
          description: The conversion mapping this entry is for.
          example: 68b1c0d4e7b91d003c45a1f7
        conversion_type:
          type: string
          title: Conversion Type
          description: The goal category the call reports, as Google names it.
          example: PURCHASE
        entity_name:
          type: string
          title: Entity Name
          description: >-
            The app entity whose records trigger the conversion. Empty for a
            mapping not tied to an entity.
          example: Order
        trigger_action:
          type: string
          title: Trigger Action
          description: The record action that triggers the conversion.
          example: create
        send_to:
          type: string
          title: Send To
          description: >-
            The exact gtag `send_to` for this goal. Copy it verbatim, because a
            conversion sent to any other value is not recorded.
          example: AW-123456789/AbCdEfGhIj
        example_call:
          type: string
          title: Example Call
          description: >-
            A minimal call to fire in the same handler where the action
            succeeds. For a revenue goal, add `value`, `currency`, and
            `transaction_id` from the real record, and never send a value of
            `0`.
          example: >-
            window.gtag('event', 'conversion', { send_to:
            'AW-123456789/AbCdEfGhIj' });
      type: object
      required:
        - mapping_id
        - conversion_type
        - entity_name
        - trigger_action
        - send_to
        - example_call
      title: TrackingConversionCall
      description: The conversion call to fire for one enabled conversion mapping.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    StandardError:
      properties:
        code:
          type: string
          title: Code
          description: >-
            Stable machine-readable cause of the failure. Match on this, not on
            `message`.
          example: not_found
        message:
          type: string
          title: Message
          description: Human-readable explanation. It isn't a stable contract.
          example: App not found
        details:
          additionalProperties: true
          type: object
          title: Details
          description: >-
            Structured context for the failure, or an empty object when there's
            none.
          example: {}
      type: object
      required:
        - code
        - message
      title: StandardError
  securitySchemes:
    PersonalAccessTokenAuth:
      type: http
      scheme: bearer
      description: >-
        Personal access token, sent as `Authorization: Bearer <token>`. Each
        operation lists the permission it needs: `read_only` or `full_access`. A
        full-access token can call every operation. A read-only token can call
        only the operations that list `read_only`; anything else returns 403
        `read_only_credential_route_not_allowed`.
    WorkspaceApiKeyAuth:
      type: apiKey
      in: header
      name: api_key
      description: >-
        Workspace API key, sent as `api_key: <key>`. Each operation that accepts
        one lists what the key needs: a permission, `read_only` or
        `full_access`, like a personal access token, or a scope. A key without
        the scope gets 403 `workspace_api_key_scope_required`.
    WorkspaceApiKeyBearerAuth:
      type: http
      scheme: bearer
      description: >-
        Workspace API key, sent as `Authorization: Bearer <key>`. Accepted
        wherever `api_key` is, with the same permission.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.