---
updatedAt: 2025-09-18T22:02:57.000Z
agentTools:
  projectIndex: https://dev.kevel.com/llms.txt
---

# Add User To Retargeting Segment

This pixel endpoint adds a specific UserKey to a Retargeting Segment.

> 📘 The Retargeting Segment does not need to be created beforehand. By pinging this endpoint, the segment will be created if it doesn't exist.

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "userdb",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://e-{networkId}.adzerk.net/udb/{networkId}",
      "variables": {
        "networkId": {
          "default": "networkId"
        }
      }
    }
  ],
  "security": [
    {}
  ],
  "paths": {
    "/rt/{advertiserID}/{segment}/i.gif": {
      "get": {
        "summary": "Add User To Retargeting Segment",
        "description": "This pixel endpoint adds a specific UserKey to a Retargeting Segment.",
        "operationId": "add-user-to-retargeting-segment",
        "parameters": [
          {
            "name": "networkId",
            "in": "path",
            "description": "Your account (network) ID",
            "schema": {
              "type": "integer",
              "format": "int32"
            },
            "required": true
          },
          {
            "name": "advertiserId",
            "in": "path",
            "description": "The ID of the Advertiser",
            "schema": {
              "type": "integer",
              "format": "int32"
            },
            "required": true
          },
          {
            "name": "segment",
            "in": "path",
            "description": "This is an integer you choose to denote the Retargeting segment. You could have multiple if you wanted to track multiple pages. That said, this is rare and most advertisers will just want a single pixel. In this case, you can just set `segment` to `1`.",
            "schema": {
              "type": "integer",
              "format": "int32"
            },
            "required": true
          },
          {
            "name": "property",
            "in": "query",
            "description": "Appends one or more key/value pairs to be shipped to UserDB logs. In the format `?property:Key1=Value&property:Key2=Value` etc.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "text/plain": {
                "examples": {
                  "Result": {
                    "value": "[Returns a 1x1 transparent GIF image]"
                  }
                }
              }
            }
          }
        },
        "deprecated": false,
        "security": [],
        "x-readme": {
          "code-samples": [
            {
              "language": "curl",
              "code": "curl -b \"azk=ue1-e397eb5990\" https://e-23.adzerk.net/udb/23/rt/78189/1/i.gif"
            },
            {
              "language": "javascript",
              "code": "const Adzerk = require('@adzerk/decision-sdk');\n\n// Demo network ID; find your own via the Adzerk UI!\nlet client = new Adzerk.Client({networkId: 23});\nclient.userDb.addRetargetingSegment(\"ue1-e397eb5990\", 78189, 1);"
            },
            {
              "language": "java",
              "code": "import com.adzerk.sdk.*;\nimport com.adzerk.sdk.generated.ApiException;\n\npublic class RetargetingSegmentUserDB {\n  public static void main(String[] argv) throws ApiException {\n    // Demo network ID; find your own via the Adzerk UI!\n    Client client = new Client(new ClientOptions(23));\n    client.userDb().addRetargetingSegment(\"ue1-e397eb5990\", 78189, 1);\n  }\n}"
            },
            {
              "language": "python",
              "code": "import adzerk_decision_sdk\n\n# Demo network ID; find your own via the Adzerk UI!\nclient = adzerk_decision_sdk.Client(23)\nclient.user_db.add_retargeting_segment(\"ue1-e397eb5990\", 78189, 1)"
            },
            {
              "language": "ruby",
              "code": "require \"adzerk_decision_sdk\"\n\n# Demo network ID; find your own via the Adzerk UI!\nclient = AdzerkDecisionSdk::Client.new(network_id: 23)\nclient.user_db.add_retargeting_segment(\"ue1-e397eb5990\", 78189, 1)"
            },
            {
              "language": "clojure",
              "code": "(ns retargeting-userdb-sample\n  (:import (com.adzerk.sdk Client ClientOptions)))\n\n(defn -main []\n  ; Demo network ID; find your own via the Adzerk UI!\n  (let [client (Client. (doto (ClientOptions. (int 23))))]\n    (-> client (.userDb) (.addRetargetingSegment \"ue1-e397eb5990\", 78189, 1))))"
            },
            {
              "language": "swift",
              "code": "import AdzerkSDK\n\n// Demo network ID; find your own via the Kevel UI!\nDecisionSDK.defaultNetworkId = 23\n\nlet keyStore = UserKeyStoreKeychain()\nkeyStore.save(userKey: \"abc\")\n\nlet client = DecisionSDK(keyStore: keyStore)\n\nclient.userDB().retargetUser(advertiserId: 78189, segment: 1) {response in\n  dump(response)\n}"
            }
          ],
          "samples-languages": [
            "curl",
            "javascript",
            "java",
            "python",
            "ruby",
            "clojure",
            "swift"
          ]
        }
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": false,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true
}
```