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

# Microsoft Advertising

> Understand how Microsoft Advertising works on OneView

export const RevokeAccessFAQ = ({platformName, oauthDashboardUrl, autoRevoke}) => {
  if (autoRevoke) {
    return <Accordion title={`Q: How do I revoke access to my ${platformName} data?`}>
        <Danger>
          Revoking access <strong>will stop OneView from sending conversions to your {platformName} account</strong>.
        </Danger>
        <p>
          You need to revoke access to your {platformName} data on both ends:
        </p>
  
        <ol>
          <li>
            <strong>From OneView</strong>: Navigate to <a href="https://oneviewhub.com/workspace/settings/ad-accounts">Ad Accounts settings</a> and disconnect your {platformName} account.
          </li>
          <li>
            <strong>From {platformName}</strong>: Use your dashboard at (<a href={oauthDashboardUrl}>{oauthDashboardUrl}</a>) and remove <strong>OneView Platform</strong> from your account.
          </li>
        </ol>
        <p>
      When you disconnect your {platformName} account from your OneView workspace, <strong>all credentials are deleted</strong> (on OneView) and <strong>access revocation is requested</strong> (to {platformName}) automatically on your behalf.
    </p>
      </Accordion>;
  }
  return <Accordion title={`Q: How do I revoke access to my ${platformName} data?`}>
      <Danger>
        Revoking access <strong>will stop OneView from sending conversions to your {platformName} account</strong>.
      </Danger>
      
      <p>
          You need to revoke access to your {platformName} data on both ends:
        </p>

      <ol>
        <li>
          <strong>From OneView</strong>: Navigate to <a href="https://oneviewhub.com/workspace/settings/ad-accounts">Ad Accounts settings</a> and disconnect your {platformName} account.
        </li>
        <li>
          <strong>From {platformName}</strong>: Use your dashboard at (<a href={oauthDashboardUrl}>{oauthDashboardUrl}</a>) and remove <strong>OneView Platform</strong> from your account.
        </li>
      </ol>
    </Accordion>;
};

export const IntegrationDataFields = ({platformName, clickIdentifiers, includeCommonFields = false}) => {
  return <>
      {clickIdentifiers && clickIdentifiers.length > 0 && <>
          <p>
            Click identifiers are automatically captured from URL parameters when users click on your {platformName} ads. When click identifiers are missing or expired, OneView uses <a href="/docs/platform/features/delivery/enhanced-conversions">Enhanced Conversions</a> with identifiers from your <a href="/docs/platform/features/processing/identity-resolution">Identity Graph</a> to maintain attribution accuracy.
          </p>
          {clickIdentifiers.map((identifier, index) => <ParamField key={index} path={identifier.name} type="string">
              <strong>{identifier.displayName || identifier.name}</strong> - {identifier.description}
            </ParamField>)}
        </>}

      {includeCommonFields && <>
          <ParamField path="conversion_date_time" type="string" required>
            <strong>Conversion Timestamp</strong> - The date and time when the conversion occurred.

            <p>
              OneView automatically converts timestamps to the timezone of your {platformName} account for accurate cross-dashboard reporting comparisons.
            </p>
          </ParamField>

          <ParamField path="transaction_id" type="string">
            <strong>Transaction ID</strong> - Unique identifier for idempotency and deduplication.

            <p>
              OneView automatically uses the <code>Idempotency-Key</code> of your event as the Event ID, or, if absent, generates a <Tooltip tip="The same payload will always generate the same Event ID.">deterministic</Tooltip> one based on the event payload.
            </p>
          </ParamField>

          <ParamField path="consent" type="object">
            <strong>Consent Information</strong> - Consent information for the conversion, using the <strong>Google Consent Mode</strong> framework.

            <p>
              OneView automatically sets consent information using the <strong>Google Consent Mode</strong> framework, with <code>ad_user_data</code> and <code>ad_personalization</code> values to enforce <a href="/docs/platform/compliance/consent">consent compliance</a>.
            </p>
          </ParamField>
        </>}
    </>;
};

export const IntegrationOverview = ({platformName}) => {
  return <>
      <p>
        {platformName} is configured as a <strong>Conversion API integration</strong> in OneView. OneView automatically sends <a href="/docs/platform/concepts/conversions">conversion data</a> to {platformName}'s API for campaign optimization.
      </p>

      <p>
        OneView automatically handles data mapping, <a href="/docs/platform/features/processing/merit-based-routing">routing rules</a>, and API communication with {platformName}. You simply need to select your <strong>Conversion Events</strong> on OneView, and OneView will take care of the rest.
      </p>
    </>;
};

export const IntegrationHero = ({logoSrc, alt = "Integration logo", maxHeight = 160}) => {
  const containerStyle = {
    display: 'flex',
    alignItems: 'center',
    justifyContent: 'center',
    width: '100%',
    height: '220px'
  };
  const imgStyle = {
    maxHeight: `${maxHeight}px`,
    maxWidth: '100%'
  };
  return <Frame>
      <div style={containerStyle}>
        <img noZoom src={logoSrc} alt={alt} style={imgStyle} />
      </div>
    </Frame>;
};

<IntegrationHero logoSrc="/assets/logos/integrations/Microsoft.svg" alt="Microsoft Advertising" />

<Tip>
  **Credentials** OneView lets you connect your Microsoft Account with OAuth, and will **automatically** handle all token updates for you in the background. You **are not** required to create an Azure OAuth app.

  To access this integration, you'll need a **Microsoft Advertising** account.
</Tip>

<IntegrationOverview platformName="Microsoft Advertising" />

## What gets sent to Microsoft Advertising

<IntegrationDataFields
  platformName="Microsoft Advertising"
  clickIdentifiers={[
{
  name: 'msclkid',
  displayName: 'Microsoft Click ID',
  description: 'Captured from URL parameters when users click on your Microsoft ads and navigate to your website.'
}
]}
  includeCommonFields={true}
/>

<IntegrationProcessing platformName="Microsoft Advertising" />

## Troubleshooting

<AccordionGroup>
  <Accordion title="Q: My Office 365 organization does not allow me to grant consent, how do I fix it?">
    <Tip>
      **Quick Answer:** You can use a regular Microsoft account instead, or configure your Office 365 tenant as described below.
    </Tip>

    **Understanding the Issue**

    This problem occurs when your Azure Active Directory (AAD) tenant restricts how users can consent to applications during authentication. The registered application behavior depends on:

    * How your Azure AAD tenant is configured
    * User consent settings for applications
    * Whether the Microsoft Advertising app exists in your tenant

    **Checking User Consent Settings**

    Your Azure AAD tenant administrator can review and modify user consent settings here:

    [https://learn.microsoft.com/azure/active-directory/manage-apps/configure-user-consent?pivots=portal#configure-user-consent-settings](https://learn.microsoft.com/azure/active-directory/manage-apps/configure-user-consent?pivots=portal#configure-user-consent-settings)

    **Common Error: AADSTS650052**

    If you encounter error [`AADSTS650052`](https://learn.microsoft.com/en-us/advertising/guides/handle-service-errors-exceptions?view=bingads-13#aadsts650052), this typically means the **Microsoft Advertising** application ID (`d42ffc93-c136-491d-b4fd-6f18168c68fd`) doesn't exist in your tenant.

    **Solution Steps**

    To resolve this issue:

    1. **Contact your Active Directory administrator**
    2. **Ask them to run the following Graph API call** to add the Microsoft Advertising app to your tenant:

    ```http theme={null}
    POST https://graph.microsoft.com/v1.0/servicePrincipals
    Content-type: application/json

    {
      "appId": "d42ffc93-c136-491d-b4fd-6f18168c68fd"
    }
    ```

    **Alternative Solution**

    If configuring the tenant isn't possible, you can bypass this restriction by using a personal Microsoft account instead of your organizational Office 365 account.
  </Accordion>

  <RevokeAccessFAQ platformName="Microsoft Advertising" oauthDashboardUrl="https://myapps.microsoft.com/" />
</AccordionGroup>
