> ## 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.

# Get Google Ads tracking script

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

Returns the gtag snippet that reports the app's conversions to Google Ads.

The snippet loads Google's tag, sets consent to denied for every purpose until the app grants it, captures the click ID from the landing URL into a first-party cookie once ad storage is granted, and reports a page view on each in-app route change. It carries the conversion ID of the first goal on the account whose tag Google has published, which covers every goal on that account.

Place the snippet once in the app's HTML rather than per page. Firing an individual conversion is separate. The app calls `gtag('event', 'conversion', ...)` at the moment the conversion happens, or you report it from the server with [Upload Google Ads conversions](/api-reference/upload-google-ads-conversions).

<Note>This endpoint accepts a personal API key. Workspace API keys are not authorized for it and are rejected with a 403.</Note>



## OpenAPI

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


        Returns the gtag snippet that reports the app's conversions to Google
        Ads.


        The snippet loads Google's tag, sets consent to denied for every purpose
        until the app grants it, captures the click ID from the landing URL into
        a first-party cookie once ad storage is granted, and reports a page view
        on each in-app route change. It carries the conversion ID of the first
        goal on the account whose tag Google has published, which covers every
        goal on that account.


        Place the snippet once in the app's HTML rather than per page. Firing an
        individual conversion is separate. The app calls `gtag('event',
        'conversion', ...)` at the moment the conversion happens, or you report
        it from the server with [Upload Google Ads
        conversions](/api-reference/upload-google-ads-conversions).


        <Note>This endpoint accepts a personal API key. Workspace API keys are
        not authorized for it and are rejected with a 403.</Note>
      operationId: >-
        get_tracking_script_endpoint_api_apps__app_id__google_ads_tracking_script_get
      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
      responses:
        '200':
          description: The snippet to place in the app.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TrackingScriptResponse'
        '401':
          description: Missing or invalid credentials.
        '403':
          description: >-
            You don't have access to this app, the app does not exist, or you
            used a workspace API key. A missing app and an app you cannot reach
            are deliberately the same answer.
components:
  schemas:
    TrackingScriptResponse:
      properties:
        script:
          anyOf:
            - type: string
            - type: 'null'
          title: Script
          description: >-
            The gtag snippet, wrapped in a `<script>` tag and ready to place in
            the app's HTML, or `null` when no goal on the account has a
            published tag yet. [Build Google Ads tracking fix
            prompt](/api-reference/build-google-ads-tracking-fix-prompt) creates
            the goals, and Google takes a few minutes to publish each tag, so a
            `null` straight after setup means you should read this again
            shortly.
          example: |-
            <script>
            window.dataLayer = window.dataLayer || [];
            function gtag(){dataLayer.push(arguments);}
            gtag('js', new Date());
            gtag('config', 'AW-123456789', {'send_page_view': false});
            </script>
      type: object
      required:
        - script
      title: TrackingScriptResponse
      description: The gtag snippet that reports the app's conversions to Google Ads.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: api_key
      description: Personal API key.

````