Here's how to use the Content API for Shopping to manage the conversion sources
for your merchant account.

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

Before you can manage conversion sources with the Content API for Shopping, you
need to [set up auto-tagging](https://support.google.com/merchants/answer/11127659)
and [claim a website](https://support.google.com/merchants/answer/176793) for your
merchant account.

## 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 admin access to a Google Analytics property, you can link the
property to your merchant account by creating a Google Analytics conversion
source.

Here's a sample that creates a new
[`ConversionSource`](https://developers.google.com/shopping-content/reference/rest/v2.1/conversionsources) object under your merchant
account for Google Analytics:

    POST https://shoppingcontent.googleapis.com/content/v2.1/{merchantId}/conversionsources/

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

Here's a sample response containing a `ConversionSource` object. Google
Analytics conversion sources have the field `googleAnalyticsLink` set, and a
`conversionSourceId` starting with `galk:`.

    {
      "conversionSourceId": "galk:{propertyId}",
      "googleAnalyticsLink": {
        "propertyId": "{propertyId}",
        "attributionSettings": {
           "attributionLookbackWindowInDays": 90,
           "atributionModel": "CROSS_CHANNEL_DATA_DRIVEN",
           "conversionType": [
            {
               "name": "purchase",
               "includeInReporting": 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 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's automatically created when you add a new
website conversion source.

Here's a sample that creates a new `ConversionSource` object under for website
tracking under your merchant account:

    POST https://shoppingcontent.googleapis.com/content/v2.1/{merchantId}/conversionsources/

    {
      "merchantCenterDestination": {
        "displayName": "My tag destination",
        "attributionSettings": {
          "attributionLookbackWindowInDays": 60,
          "attributionModel": "CROSS_CHANNEL_LAST_CLICK"
        },
        "currencyCode": "CHF"
      }
    }

Here's a sample response containing a `ConversionSource` object. Website
conversion sources have the field `merchantCenterDestination` set and a
`conversionSourceId` starting with `mcdn:`.

    {
      "conversionSourceId": "mcdn:12341241234",
      "merchantCenterDestination": {
        "destinationId": "MC-ABCD1234",
        "attributionSettings": {
          "attributionLookbackWindowInDays": 60,
          "attributionModel": "CROSS_CHANNEL_LAST_CLICK"
        },
        "displayName": "My tag destination",
        "currencyCode": "CHF"
      },
      "state": "ACTIVE",
      "controller": "MERCHANT"
    }

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