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

# Google Performance Max अभियान

> अपने टेक्स्ट और इमेज से Google Ads Performance Max अभियान बनाएँ

> [!WARNING]
>
> **पहले कन्वर्ज़न ट्रैकिंग सेट अप करें।** Performance Max आपके कन्वर्ज़न का उपयोग यह तय करने के लिए करता है कि विज्ञापन कहाँ दिखाए जाएँ और कितनी बिड लगाई जाए। Ayrshare इसके बिना किसी अभियान को नहीं रोकता, लेकिन जब तक आपके Google Ads खाते में कन्वर्ज़न ट्रैकिंग सेट अप नहीं होती, Google उसके खर्च को सीमित कर सकता है। Ayrshare इसे आपके लिए सेट अप नहीं करता। जब खाते में यह नहीं होती, तो create रिस्पॉन्स में यह बताने वाली एक `warnings` प्रविष्टि शामिल होती है।

एक ही अनुरोध में Google Ads Performance Max अभियान बनाएँ। आप टेक्स्ट और इमेज URL भेजते हैं; Google उन्हें मिलाकर Search, YouTube, Display, Discover, Gmail और Maps पर विज्ञापन बनाता है। Ayrshare बजट, अभियान, एक asset group और उसके सभी assets को एक साथ बनाता है। यदि Google किसी भी हिस्से को अस्वीकार करता है, तो कुछ भी नहीं बनाया जाता।

अनुरोध साझा [विज्ञापन अभियान](https://www.ayrshare.com/docs/apis/ads/campaigns.md) स्वरूप का उपयोग करता है। अभियान पढ़ना और बदलना, इनसाइट्स और त्रुटियाँ वैसे ही काम करते हैं जैसे [Google सर्च अभियान](https://www.ayrshare.com/docs/apis/ads/google/search-campaigns.md) पर। यह पेज उन बातों को कवर करता है जो अलग हैं।

<ul>
  <li>Google विज्ञापन प्रति खाता चालू किए जाते हैं। इन्हें सक्षम करने के लिए हमसे संपर्क करें।</li>
  <li>नए अभियान `paused` स्थिति में शुरू होते हैं, जब तक आप `status: "active"` नहीं भेजते।</li>
  <li>बजट प्रति दिन होता है, विज्ञापन खाते की मुद्रा में, और इसे कभी भी अन्य अभियानों के साथ साझा नहीं किया जाता।</li>
  <li>किसी अन्य मुद्रा में हुआ खर्च बिलिंग के लिए Open Exchange Rates की उस दिन की विनिमय दर पर USD में बदला जाता है। ऐसी मुद्रा वाला खाता जिसे बदला नहीं जा सकता, कुछ भी बनाए जाने से पहले `code: 101` लौटाता है।</li>
  <li>वीडियो समर्थित नहीं है। Google आपकी इमेज से वीडियो बना सकता है।</li>
</ul>

## हेडर पैरामीटर

**Authorization** `string` *required*

[API Key](https://www.ayrshare.com/docs/apis/overview.md#authorization) of the Primary Profile.

Format: `Authorization: Bearer API_KEY`
**Profile-Key** `string`

[Profile Key](https://www.ayrshare.com/docs/apis/overview.md#profile-key-format) of a User Profile.

Format: `Profile-Key: PROFILE_KEY`

**Idempotency-Key** `string` *required*

प्रत्येक नए अभियान के लिए एक नया यूनिक मान, जैसे UUID। किसी अनुरोध को उसी key के साथ दोहराने पर पहला रिस्पॉन्स लौटता है। जब कोई create, Ayrshare द्वारा अभियान को Google पर भेजे जाने से पहले विफल होता है (उदाहरण के लिए, गलत आकार की कोई इमेज), तो key मुक्त हो जाती है, इसलिए आप अनुरोध ठीक करके उसी key के साथ पुनः प्रयास कर सकते हैं।

## बॉडी पैरामीटर

**type** `string` *required*

`performanceMax`।

**bidding** `object` *required*

Performance Max केवल ये रणनीतियाँ स्वीकार करता है। कोई अन्य रणनीति `code: 101` लौटाती है।

<ul>
  <li>`maximizeConversions`: बजट में अधिकतम कन्वर्ज़न पाएँ।</li>
  <li>`targetCpa` के साथ `targetCpa`: वही, उस प्रति कन्वर्ज़न लागत को लक्ष्य बनाते हुए।</li>
  <li>`maximizeConversionValue`: बजट में अधिकतम कन्वर्ज़न मूल्य पाएँ।</li>
  <li>`targetRoas` के साथ `targetRoas`: वही, विज्ञापन खर्च पर उस रिटर्न को लक्ष्य बनाते हुए, उदाहरण के लिए 350% के लिए `3.5`।</li>
</ul>

**euPoliticalAdvertising** `boolean` *required*

Google हर अभियान पर इस घोषणा की माँग करता है।

**targeting.locations** `string[]`

Google location ids, उदाहरण के लिए संयुक्त राज्य अमेरिका के लिए `2840`। हर लोकेशन को टार्गेट करने के लिए इसे छोड़ दें।

**platformOptions.google** `object` *required*

**गुण**

**finalUrl** `string` *required*

वह `http` या `https` पेज जिसे विज्ञापन खोलते हैं।

**assets** `object` *required*

आपका टेक्स्ट और इमेज। हर सूची के आइटम एक-दूसरे से अलग होने चाहिए।

**गुण**

**headlines** `string[]` *required*

3 से 15, प्रत्येक अधिकतम 30 अक्षर।

**longHeadlines** `string[]` *required*

1 से 5, प्रत्येक अधिकतम 90 अक्षर।

**descriptions** `string[]` *required*

2 से 5, प्रत्येक अधिकतम 90 अक्षर। कम से कम एक 60 अक्षर या उससे कम का होना चाहिए।

**businessName** `string` *required*

एक व्यवसाय नाम, अधिकतम 25 अक्षर।

**marketingImages** `string[]` *required*

1 से 20 landscape इमेज URL: 1.91:1, कम से कम 600×314।

**squareMarketingImages** `string[]` *required*

1 से 20 वर्गाकार इमेज URL: 1:1, कम से कम 300×300।

**logos** `string[]` *required*

1 से 5 वर्गाकार लोगो URL: 1:1, कम से कम 128×128।

**landscapeLogos** `string[]`

अधिकतम 4 चौड़े लोगो URL: 4:1, कम से कम 512×128। Google लोगो और चौड़े लोगो मिलाकर अधिकतम 5 स्वीकार करता है।

### इमेज

Ayrshare हर इमेज को उसके URL से डाउनलोड करता है और Google पर कुछ भी भेजने से पहले उसकी जाँच करता है:

<ul>
  <li>GIF, JPG या PNG, प्रत्येक अधिकतम 5120 KB।</li>
  <li>कम से कम ऊपर बताया गया न्यूनतम आकार, अपने फ़ील्ड के aspect ratio के साथ (1% के भीतर)।</li>
  <li>सभी इमेज मिलाकर अधिकतम 45 MB।</li>
  <li>URL सार्वजनिक होना चाहिए। निजी पते अस्वीकार किए जाते हैं।</li>
</ul>

विफल होने वाली इमेज उसका नाम बताते हुए `code: 101` लौटाती है, उदाहरण के लिए `platformOptions.google.assets.logos[0]: the image is 100x100; use at least 128x128.`

```bash cURL theme={"system"}
curl \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: 0b7a6f1c-2d4e-4c55-9a3e-2f8d1b7c9e11" \
-X POST https://api.ayrshare.com/api/ads/google/campaigns \
-d '{
  "accountId": "123-456-7890",
  "name": "Fall sale PMax",
  "type": "performanceMax",
  "budget": { "amount": 40, "type": "daily" },
  "bidding": { "strategy": "maximizeConversions" },
  "targeting": { "locations": ["2840"] },
  "euPoliticalAdvertising": false,
  "platformOptions": {
    "google": {
      "finalUrl": "https://example.com/fall-sale",
      "assets": {
        "headlines": ["Fall sale", "Shoes 30% off", "Free returns"],
        "longHeadlines": ["Every running shoe 30% off this week only"],
        "descriptions": ["Every shoe 30% off this week.", "Free returns on every order."],
        "businessName": "Acme Shoes",
        "marketingImages": ["https://example.com/images/fall-1200x628.png"],
        "squareMarketingImages": ["https://example.com/images/fall-1200x1200.png"],
        "logos": ["https://example.com/images/logo-512.png"]
      }
    }
  }
}'
```

```javascript JavaScript theme={"system"}
const API_KEY = "API_KEY";

fetch("https://api.ayrshare.com/api/ads/google/campaigns", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${API_KEY}`,
    "Content-Type": "application/json",
    "Idempotency-Key": "0b7a6f1c-2d4e-4c55-9a3e-2f8d1b7c9e11"
  },
  body: JSON.stringify({
    "accountId": "123-456-7890",
    "name": "Fall sale PMax",
    "type": "performanceMax",
    "budget": { "amount": 40, "type": "daily" },
    "bidding": { "strategy": "maximizeConversions" },
    "targeting": { "locations": ["2840"] },
    "euPoliticalAdvertising": false,
    "platformOptions": {
      "google": {
        "finalUrl": "https://example.com/fall-sale",
        "assets": {
          "headlines": ["Fall sale", "Shoes 30% off", "Free returns"],
          "longHeadlines": ["Every running shoe 30% off this week only"],
          "descriptions": ["Every shoe 30% off this week.", "Free returns on every order."],
          "businessName": "Acme Shoes",
          "marketingImages": ["https://example.com/images/fall-1200x628.png"],
          "squareMarketingImages": ["https://example.com/images/fall-1200x1200.png"],
          "logos": ["https://example.com/images/logo-512.png"]
        }
      }
    }
  })
})
  .then((res) => res.json())
  .then((json) => console.log(json))
  .catch(console.error);
```

```python Python theme={"system"}
import requests

headers = {
    "Authorization": "Bearer API_KEY",
    "Idempotency-Key": "0b7a6f1c-2d4e-4c55-9a3e-2f8d1b7c9e11",
}

payload = {
  "accountId": "123-456-7890",
  "name": "Fall sale PMax",
  "type": "performanceMax",
  "budget": { "amount": 40, "type": "daily" },
  "bidding": { "strategy": "maximizeConversions" },
  "targeting": { "locations": ["2840"] },
  "euPoliticalAdvertising": False,
  "platformOptions": {
    "google": {
      "finalUrl": "https://example.com/fall-sale",
      "assets": {
        "headlines": ["Fall sale", "Shoes 30% off", "Free returns"],
        "longHeadlines": ["Every running shoe 30% off this week only"],
        "descriptions": ["Every shoe 30% off this week.", "Free returns on every order."],
        "businessName": "Acme Shoes",
        "marketingImages": ["https://example.com/images/fall-1200x628.png"],
        "squareMarketingImages": ["https://example.com/images/fall-1200x1200.png"],
        "logos": ["https://example.com/images/logo-512.png"]
      }
    }
  }
}

r = requests.post("https://api.ayrshare.com/api/ads/google/campaigns", headers=headers, json=payload)

print(r.json())
```

```php PHP theme={"system"}
<?php
$payload = <<<'JSON'
{
  "accountId": "123-456-7890",
  "name": "Fall sale PMax",
  "type": "performanceMax",
  "budget": { "amount": 40, "type": "daily" },
  "bidding": { "strategy": "maximizeConversions" },
  "targeting": { "locations": ["2840"] },
  "euPoliticalAdvertising": false,
  "platformOptions": {
    "google": {
      "finalUrl": "https://example.com/fall-sale",
      "assets": {
        "headlines": ["Fall sale", "Shoes 30% off", "Free returns"],
        "longHeadlines": ["Every running shoe 30% off this week only"],
        "descriptions": ["Every shoe 30% off this week.", "Free returns on every order."],
        "businessName": "Acme Shoes",
        "marketingImages": ["https://example.com/images/fall-1200x628.png"],
        "squareMarketingImages": ["https://example.com/images/fall-1200x1200.png"],
        "logos": ["https://example.com/images/logo-512.png"]
      }
    }
  }
}
JSON;

$curl = curl_init();

curl_setopt_array($curl, [
    CURLOPT_URL => "https://api.ayrshare.com/api/ads/google/campaigns",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer API_KEY",
        "Content-Type: application/json",
        "Idempotency-Key: 0b7a6f1c-2d4e-4c55-9a3e-2f8d1b7c9e11"
    ],
    CURLOPT_POSTFIELDS => $payload
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
    echo "cURL Error: " . $err;
} else {
    echo $response;
}
?>
```

```csharp C# theme={"system"}
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        var client = new HttpClient();
        client.DefaultRequestHeaders.Add("Authorization", "Bearer API_KEY");
        client.DefaultRequestHeaders.Add("Idempotency-Key", "0b7a6f1c-2d4e-4c55-9a3e-2f8d1b7c9e11");

        var payload = """
            {
              "accountId": "123-456-7890",
              "name": "Fall sale PMax",
              "type": "performanceMax",
              "budget": { "amount": 40, "type": "daily" },
              "bidding": { "strategy": "maximizeConversions" },
              "targeting": { "locations": ["2840"] },
              "euPoliticalAdvertising": false,
              "platformOptions": {
                "google": {
                  "finalUrl": "https://example.com/fall-sale",
                  "assets": {
                    "headlines": ["Fall sale", "Shoes 30% off", "Free returns"],
                    "longHeadlines": ["Every running shoe 30% off this week only"],
                    "descriptions": ["Every shoe 30% off this week.", "Free returns on every order."],
                    "businessName": "Acme Shoes",
                    "marketingImages": ["https://example.com/images/fall-1200x628.png"],
                    "squareMarketingImages": ["https://example.com/images/fall-1200x1200.png"],
                    "logos": ["https://example.com/images/logo-512.png"]
                  }
                }
              }
            }
            """;

        var response = await client.PostAsync(
            "https://api.ayrshare.com/api/ads/google/campaigns",
            new StringContent(payload, Encoding.UTF8, "application/json"));
        var content = await response.Content.ReadAsStringAsync();

        Console.WriteLine(content);
    }
}
```

```go Go theme={"system"}
package main

import (
    "fmt"
    "io"
    "net/http"
    "strings"
)

func main() {
    payload := `{
  "accountId": "123-456-7890",
  "name": "Fall sale PMax",
  "type": "performanceMax",
  "budget": { "amount": 40, "type": "daily" },
  "bidding": { "strategy": "maximizeConversions" },
  "targeting": { "locations": ["2840"] },
  "euPoliticalAdvertising": false,
  "platformOptions": {
    "google": {
      "finalUrl": "https://example.com/fall-sale",
      "assets": {
        "headlines": ["Fall sale", "Shoes 30% off", "Free returns"],
        "longHeadlines": ["Every running shoe 30% off this week only"],
        "descriptions": ["Every shoe 30% off this week.", "Free returns on every order."],
        "businessName": "Acme Shoes",
        "marketingImages": ["https://example.com/images/fall-1200x628.png"],
        "squareMarketingImages": ["https://example.com/images/fall-1200x1200.png"],
        "logos": ["https://example.com/images/logo-512.png"]
      }
    }
  }
}`

    req, _ := http.NewRequest("POST", "https://api.ayrshare.com/api/ads/google/campaigns", strings.NewReader(payload))
    req.Header.Add("Authorization", "Bearer API_KEY")
    req.Header.Add("Content-Type", "application/json")
    req.Header.Add("Idempotency-Key", "0b7a6f1c-2d4e-4c55-9a3e-2f8d1b7c9e11")

    resp, err := http.DefaultClient.Do(req)
    if err != nil {
        fmt.Println("Error:", err)
        return
    }
    defer resp.Body.Close()

    body, _ := io.ReadAll(resp.Body)
    fmt.Println(string(body))
}
```

```java Java theme={"system"}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class CreateCampaign {
    public static void main(String[] args) throws Exception {
        String payload = """
            {
              "accountId": "123-456-7890",
              "name": "Fall sale PMax",
              "type": "performanceMax",
              "budget": { "amount": 40, "type": "daily" },
              "bidding": { "strategy": "maximizeConversions" },
              "targeting": { "locations": ["2840"] },
              "euPoliticalAdvertising": false,
              "platformOptions": {
                "google": {
                  "finalUrl": "https://example.com/fall-sale",
                  "assets": {
                    "headlines": ["Fall sale", "Shoes 30% off", "Free returns"],
                    "longHeadlines": ["Every running shoe 30% off this week only"],
                    "descriptions": ["Every shoe 30% off this week.", "Free returns on every order."],
                    "businessName": "Acme Shoes",
                    "marketingImages": ["https://example.com/images/fall-1200x628.png"],
                    "squareMarketingImages": ["https://example.com/images/fall-1200x1200.png"],
                    "logos": ["https://example.com/images/logo-512.png"]
                  }
                }
              }
            }
            """;

        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://api.ayrshare.com/api/ads/google/campaigns"))
            .header("Authorization", "Bearer API_KEY")
            .header("Content-Type", "application/json")
            .header("Idempotency-Key", "0b7a6f1c-2d4e-4c55-9a3e-2f8d1b7c9e11")
            .POST(HttpRequest.BodyPublishers.ofString(payload))
            .build();

        HttpResponse<String> response = HttpClient.newHttpClient()
            .send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.body());
    }
}
```

```ruby Ruby theme={"system"}
require 'net/http'
require 'uri'

uri = URI.parse('https://api.ayrshare.com/api/ads/google/campaigns')

request = Net::HTTP::Post.new(uri)
request['Authorization'] = 'Bearer API_KEY'
request['Content-Type'] = 'application/json'
request['Idempotency-Key'] = '0b7a6f1c-2d4e-4c55-9a3e-2f8d1b7c9e11'
request.body = <<~JSON
  {
    "accountId": "123-456-7890",
    "name": "Fall sale PMax",
    "type": "performanceMax",
    "budget": { "amount": 40, "type": "daily" },
    "bidding": { "strategy": "maximizeConversions" },
    "targeting": { "locations": ["2840"] },
    "euPoliticalAdvertising": false,
    "platformOptions": {
      "google": {
        "finalUrl": "https://example.com/fall-sale",
        "assets": {
          "headlines": ["Fall sale", "Shoes 30% off", "Free returns"],
          "longHeadlines": ["Every running shoe 30% off this week only"],
          "descriptions": ["Every shoe 30% off this week.", "Free returns on every order."],
          "businessName": "Acme Shoes",
          "marketingImages": ["https://example.com/images/fall-1200x628.png"],
          "squareMarketingImages": ["https://example.com/images/fall-1200x1200.png"],
          "logos": ["https://example.com/images/logo-512.png"]
        }
      }
    }
  }
JSON

response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
  http.request(request)
end

puts response.body
```

```json 200: Campaign Created theme={"system"}
{
  "status": "success",
  "platform": "google",
  "campaignId": "21534567891",
  "assetGroupId": "6512345678",
  "campaignStatus": "paused"
}
```

```json 200: Created, No Conversion Tracking theme={"system"}
{
  "status": "success",
  "platform": "google",
  "campaignId": "21534567891",
  "assetGroupId": "6512345678",
  "campaignStatus": "paused",
  "warnings": [
    "This Google Ads account has no conversion tracking. Performance Max optimizes for conversions, so Google may limit the campaign's spend until you set up conversion tracking in Google Ads."
  ]
}
```

```json 400: Image Too Small theme={"system"}
{
  "action": "request",
  "status": "error",
  "code": 101,
  "message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
  "details": "platformOptions.google.assets.logos[0]: the image is 100x100; use at least 128x128."
}
```


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