Here's how to use the Merchant API to manage the conversion sources for
your Merchant Center account.

Merchant Center conversion sources let you view conversion data from
[free listings](https://support.google.com/merchants/answer/13889434), and from [your website](https://support.google.com/merchants/answer/13071753), in your
Merchant Center account.

Before you can manage conversion sources with the Merchant API, you need
to [set up autotagging](https://support.google.com/merchants/answer/11127659) and [claim a website](https://support.google.com/merchants/answer/176793) for
your Merchant Center account. A Merchant Center account can have up to 200
conversion sources.

## Link Google Analytics

You can use [Google Analytics](https://support.google.com/merchants/answer/12046446) to track conversions on your free
listings and your website.

If you have administrator access to a Google Analytics property, you can
link the property to your Merchant Center account by creating a
Google Analytics conversion source.

The following API request creates a new
[`ConversionSource`](https://developers.google.com/merchant/api/reference/rest/conversions_v1/accounts.conversionSources#resource:-conversionsource) object under your Merchant Center
account for Google Analytics:

    POST  https://merchantapi.googleapis.com/conversions/v1/accounts/ACCOUNT_ID/conversionSources

    {
     "googleAnalyticsLink": {
       "propertyId": PROPERTY_ID
      }
    }

The following sample response contains a `ConversionSource` object. Google
Analytics conversion sources have the field `googleAnalyticsLink` set and
their name follows the `accounts/{ACCOUNT}/conversionSources/galk:{PROPERTY_ID}`.

    {
      "name": "accounts/{ACCOUNT_ID}/conversionSources/galk:PROPERTY_ID"
      "googleAnalyticsLink": {
        "propertyId": "PROPERTY_ID",
        "attributionSettings": {
          "attributionLookbackWindowDays": 30,
          "atributionModel": "CROSS_CHANNEL_DATA_DRIVEN",
          "conversionType": [
            {
              "name": "purchase",
              "report": true
            }
          ]
        },
        "propertyName": "My Property Name"
      },
     "state": "ACTIVE",
     "controller": "MERCHANT"
    }

## Use a Google tag

If you don't have a Google Analytics property, you can send conversion
data directly to your Merchant Center account by
[creating a website conversion source with a Google tag](https://support.google.com/merchants/answer/13071753).
You can use the [Google Tag Manager API](https://developers.google.com/tag-platform/tag-manager/api/v2) to set up an existing
Google tag, or use the new tag that is automatically created when you add a new
website conversion source.

Here's a sample that creates a new
[`accounts.conversionSources`](https://developers.google.com/merchant/api/reference/rest/conversions_v1/accounts.conversionSources)
object for website tracking under your Merchant Center account:

    POST https://merchantapi.googleapis.com/conversions/v1/accounts/ACCOUNT_ID/conversionSources

    {
      "merchantCenterDestination": {
        "attributionSettings": {
          "attributionLookbackWindowDays": 30,
          "attributionModel": "CROSS_CHANNEL_LAST_CLICK"
        },
        "displayName": "My tag destination",
        "currencyCode": "CHF"
      }
    }

Here's a sample response that contains a `ConversionSource` object. Website
conversion sources have the field `merchantCenterDestination` set and
their name follows the `accounts/{ACCOUNT_ID}/conversionSources/mcdn:{PROPERTY_ID}`.

    {
      "name": "accounts/{ACCOUNT_ID}/conversionSources/mcdn:{PROPERTY_ID}",
      "merchantCenterDestination": {
        "destination": "MC-ABCD1234",
        "attributionSettings": {
          "attributionLookbackWindowDays": 30,
          "attributionModel": "CROSS_CHANNEL_LAST_CLICK"
        },
        "displayName": "My tag destination",
        "currencyCode": "CHF"
      },
      "state": "ACTIVE",
      "controller": "MERCHANT"
    }

Once created, you can use the conversion source's `destination` with a
[Google tag](https://developers.google.com/tag-platform/tag-manager) to get conversion data directly from your website.

## Learn more

To learn about migrating from Content API for Shopping, see
[Migrate conversion sources management](https://developers.google.com/merchant/api/guides/compatibility/conversion-sources).