---
title: "Save placement piggyback"
type: reference
method: POST
path: /rest-api/piggyback/placement.do
tag: "Piggybacks"
---

# Save placement piggyback

`POST https://YOUR-NETWORK-DOMAIN/rest-api/piggyback/placement.do`

Creates a new piggyback tracking pixel and attaches it to the specified placement, or with 'id' edits that existing piggyback of the placement. The piggyback can be of type BEACON (HTML tracking code snippet) or URL (redirect URL), specified via the model attribute fields 'type' and 'codeUrl'. You can target a specific action by providing actionId, or set allActions to true to apply to all actions of the campaign. The caller must have update permissions on the placement's parent site. Returns a JSON object with a 'success' boolean and validation errors if any.

## Form params

| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| `placementId` | integer | yes | `4001` | The unique numeric identifier of the placement to attach the new piggyback tracking pixel to |
| `campaignId` | integer | yes | `2001` | The unique numeric identifier of the campaign that the placement belongs to |
| `actionId` | integer | no | `101` | Conditionally required — when allActions is false; ignored when it is true. The unique numeric identifier of the action to attach the piggyback to |
| `allActions` | boolean | no | `true` | When true, the piggyback is applied to all actions of the campaign, making actionId unnecessary |
| `id` | integer | no | `701` | ID of an existing piggyback of this placement to edit instead of creating a new one; one that is not the placement's answers 400 |
| `active` | boolean | no | `true` | Whether this piggyback is active |
| `codeUrl` | string | no | `https://tracker.example.com/pixel?pid=789` | Piggyback URL or HTML/JavaScript code |
| `deliveryAttribution` | string | no | `ALL` | Which conversions this piggyback fires for: ALL, POST_CLICK_ONLY or POST_VIEW_ONLY |
| `sampling` | integer | no | `100` | Sampling rate percentage (0-100) controlling how often the piggyback fires |
| `type` | string | no | `URL` | Piggyback type: URL (a URL fired as a pixel) or BEACON (an HTML/JavaScript snippet) |

## Responses

- `200` — Placement piggyback saved successfully
- `400` — Bad request — invalid or missing parameters
- `401` — Unauthorized - authentication error
- `403` — Forbidden - no update rights on the placement, or the Piggyback Pixel Tracking permission is not enabled
- `404` — Placement not found or deleted, or campaign not found
- `500` — Internal server error

## Example request

```bash
curl --request POST \
  --url 'https://YOUR-NETWORK-DOMAIN/rest-api/piggyback/placement.do' \
  --header 'X-Api-Key: YOUR_API_KEY' \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --data-urlencode 'placementId=4001' \
  --data-urlencode 'campaignId=2001' \
  --data-urlencode 'id=701' \
  --data-urlencode 'type=URL' \
  --data-urlencode 'active=true' \
  --data-urlencode 'actionId=101'
```

Source: https://epom.com/ad-server/docs/api/piggybacks/post-piggyback-placement