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

# Track Brand Globally

> Set GTB — register an advertiser in the global refresh registry.

The inverse of ``untrack_brand`` and the admin counterpart of the
user-facing Track button, minus everything that button does on the
tenant's behalf. It registers the advertiser for the nightly refresh sweep
and **nothing else**: no watchlist, no watchlist item, no
``user_ad_library_tracked_advertisers`` row, no global-promotion quota
consumed, no owning brand implied. An operator tracking a brand for the
platform is not a tenant tracking it for themselves, and the census must
not start reporting a UTB that no user asked for.

It also does not enqueue an initial refresh. Registration is the whole
action; the nightly sweep is what collects, on its own schedule and
budget. Kicking off an immediate paid fetch from an admin census button
would be acquisition the operator did not ask for.

Written through ``promote_advertiser_to_global_tracking`` — the public
seam over ``_ensure_global_tracking``, whose entire body is a passthrough
to it. Same ``ON CONFLICT DO NOTHING`` insert and market merge; this
module reaches for the public name for the same reason it imports the
public ``untrack_advertiser_globally`` rather than that function's
internals.

Two refusals, both 409, both re-derived here rather than trusted from the
census page (see ``global_tracking_block_reason`` for why each holds).
They are checked BEFORE the already-tracked no-op: answering "200, tracked"
for a ``tenant_private`` row would report a healthy state for exactly the
state this endpoint exists to keep out of the paid sweep. Already-tracked
is then a 200 with ``already_tracked=true`` — no write, no audit row, no
commit.

Both the audit row and the response report the countries the registry row
HOLDS after the write, re-read rather than assumed: the advertiser lock
does not cover the registry table, so a tenant's own Track landing in the
same window makes the stored value the union of both
(``persisted_tracking_countries``).



## OpenAPI

````yaml /openapi.json post /api/v1/admin/brand-library/brands/{advertiser_id}/global-tracking
openapi: 3.1.0
info:
  title: AITasker
  version: 0.1.0
servers: []
security: []
paths:
  /api/v1/admin/brand-library/brands/{advertiser_id}/global-tracking:
    post:
      tags:
        - Admin Brand Library
        - Admin
      summary: Track Brand Globally
      description: >-
        Set GTB — register an advertiser in the global refresh registry.


        The inverse of ``untrack_brand`` and the admin counterpart of the

        user-facing Track button, minus everything that button does on the

        tenant's behalf. It registers the advertiser for the nightly refresh
        sweep

        and **nothing else**: no watchlist, no watchlist item, no

        ``user_ad_library_tracked_advertisers`` row, no global-promotion quota

        consumed, no owning brand implied. An operator tracking a brand for the

        platform is not a tenant tracking it for themselves, and the census must

        not start reporting a UTB that no user asked for.


        It also does not enqueue an initial refresh. Registration is the whole

        action; the nightly sweep is what collects, on its own schedule and

        budget. Kicking off an immediate paid fetch from an admin census button

        would be acquisition the operator did not ask for.


        Written through ``promote_advertiser_to_global_tracking`` — the public

        seam over ``_ensure_global_tracking``, whose entire body is a
        passthrough

        to it. Same ``ON CONFLICT DO NOTHING`` insert and market merge; this

        module reaches for the public name for the same reason it imports the

        public ``untrack_advertiser_globally`` rather than that function's

        internals.


        Two refusals, both 409, both re-derived here rather than trusted from
        the

        census page (see ``global_tracking_block_reason`` for why each holds).

        They are checked BEFORE the already-tracked no-op: answering "200,
        tracked"

        for a ``tenant_private`` row would report a healthy state for exactly
        the

        state this endpoint exists to keep out of the paid sweep.
        Already-tracked

        is then a 200 with ``already_tracked=true`` — no write, no audit row, no

        commit.


        Both the audit row and the response report the countries the registry
        row

        HOLDS after the write, re-read rather than assumed: the advertiser lock

        does not cover the registry table, so a tenant's own Track landing in
        the

        same window makes the stored value the union of both

        (``persisted_tracking_countries``).
      operationId: >-
        track_brand_globally_api_v1_admin_brand_library_brands__advertiser_id__global_tracking_post
      parameters:
        - name: advertiser_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Advertiser Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BrandLibraryGlobalTrackingResult'
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BrandLibraryConflictResponse'
          description: Conflict
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    BrandLibraryGlobalTrackingResult:
      properties:
        advertiser_id:
          type: string
          format: uuid
          title: Advertiser Id
        is_gtb:
          type: boolean
          title: Is Gtb
        already_tracked:
          type: boolean
          title: Already Tracked
        tracking_countries:
          items:
            type: string
          type: array
          title: Tracking Countries
          default: []
      type: object
      required:
        - advertiser_id
        - is_gtb
        - already_tracked
      title: BrandLibraryGlobalTrackingResult
      description: |-
        What the global-tracking registration left on the row.

        ``is_gtb`` is always ``True`` on a 2xx — the endpoint either registered
        the advertiser or found it already registered. ``already_tracked``
        separates those two so the client can tell a real write from a no-op
        without diffing its own stale row state.
    BrandLibraryConflictResponse:
      properties:
        detail:
          type: string
          title: Detail
      type: object
      required:
        - detail
      title: BrandLibraryConflictResponse
      description: A server-side refusal to change a Brand Library advertiser.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````