# Marketo Destination Config Reference

<p><a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/marketo/" >Marketo</a> is a marketing automation destination. RudderStack creates and updates Marketo leads from <code>identify</code> events, and records <code>track</code> events as custom activities on those leads, from its servers.</p>
<p>In a Marketo destination spec:</p>
<ul>
<li><code>type: marketo</code></li>
<li><code>definition_version: 1</code></li>
</ul>
<!-- end-chunk -->
<!-- begin-chunk -->
<h2 id="sample-configuration">Sample configuration</h2><div class="rs-code">
  <div class="rs-code__head">yaml<button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">version: rudder/v1
kind: destination
metadata:
  name: marketo-prod
spec:
  id: marketo-prod
  display_name: Marketo Production
  type: marketo
  definition_version: 1
  enabled: true
  config:
    account_id: 123-ABC-456
    client_id: &#34;{{ .MARKETO_CLIENT_ID }}&#34;
    client_secret: &#34;{{ .MARKETO_CLIENT_SECRET }}&#34;

    track_anonymous_events: false
    create_if_not_exist: true

    rudder_events_mapping:
      - event: Product Clicked
        marketo_activity_id: &#34;100001&#34;
        marketo_primarykey: product_id
    custom_activity_property_map:
      - from: product_name
        to: productName
    lead_trait_mapping:
      - from: leadScore
        to: customLeadScore

    connection_mode:
      web: cloud
      cloud: cloud
    consent_management:
      web:
        - provider: oneTrust
          consents:
            - marketing</code></pre></div>
</div>
<p>The above example records <code>Product Clicked</code> events as a custom activity and fails every other <code>track</code> event — Marketo receives only the events <a href="#rudder_events_mapping" ><code>rudder_events_mapping</code></a> names. Note that <code>marketo_activity_id</code> is a quoted string — see <a href="#mappings" >Mappings</a>.</p>
<!-- end-chunk -->
<!-- begin-chunk -->
<h2 id="config-keys">Config keys</h2><p><code>config</code> accepts only the keys listed below. The <a href="https://www.rudderstack.com/docs/dev-tools/rudder-cli/destination-types/#config-key-rules" >shared config key rules</a> cover unknown keys, defaults, and immutability.</p>

<html lang="en">
<blockquote class="info">
  <div class="tip-quote">
    
    <div class="tip-text">Marketo accepts only <code>identify</code> and <code>track</code> events. RudderStack doesn&rsquo;t deliver any other event type to it.</div>
  </div>
</blockquote>

</html>
<!-- end-chunk -->
<!-- begin-chunk -->
<h3 id="connection">Connection</h3><div class="rs-ckeys">
<div class="rs-ckey" id="account_id">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">account_id</p>Required</div>
  <p class="rs-ckey__field">
    Type:
    <code>string</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Munchkin account ID of your Marketo instance, such as <code>123-ABC-456</code>. RudderStack calls Marketo&rsquo;s REST API on <code>&lt;account_id&gt;.mktorest.com</code>. The dashboard calls it <strong>Munchkin Account Id</strong>.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li>At most 100 characters, and must not contain line breaks.</li>
<li>A <code>{{ path || fallback }}</code> template is accepted in place of a literal.</li>
</ul>

</div>

<div class="rs-ckey__extra">
  See <a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/marketo/#connection-settings" >Connection settings</a> for where to find the Munchkin account ID.
</div>

</div>

<div class="rs-ckey" id="client_id">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">client_id</p>RequiredSecret</div>
  <p class="rs-ckey__field">
    Type:
    <code>string</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Client ID of the Marketo REST API service RudderStack authenticates as — a custom LaunchPoint service tied to an API-only user.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li>At most 100 characters, and must not contain line breaks.</li>
<li>A <code>{{ path || fallback }}</code> template is accepted in place of a literal.</li>
</ul>

</div>

<div class="rs-ckey__extra">
  <p>Supply it as a <code>{{ .VAR }}</code> reference rather than a literal — see <a href="#secrets" >Secrets</a>.</p>
<p>See <a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/marketo/#how-do-i-obtain-the-marketo-client-id-and-secret" >How do I obtain the Marketo client ID and secret?</a>.</p>

</div>

</div>

<div class="rs-ckey" id="client_secret">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">client_secret</p>RequiredSecret</div>
  <p class="rs-ckey__field">
    Type:
    <code>string</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Client secret of the same REST API service.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li>At most 100 characters, and must not contain line breaks.</li>
<li>A <code>{{ path || fallback }}</code> template is accepted in place of a literal.</li>
</ul>

</div>

<div class="rs-ckey__extra">
  Supply it as a <code>{{ .VAR }}</code> reference rather than a literal — see <a href="#secrets" >Secrets</a>.
</div>

</div>

</div>

<!-- end-chunk -->
<!-- begin-chunk -->
<h3 id="lead-matching">Lead matching</h3><p>RudderStack finds the lead an event belongs to by its <code>marketoLeadId</code> external ID when the event carries one. Otherwise, it looks the lead up by the event&rsquo;s email or, when there&rsquo;s no email, by its <code>userId</code> — or its <code>anonymousId</code> when there&rsquo;s no <code>userId</code> — stored in Marketo lead fields with those exact API names.</p>

<blockquote class="warning">
  <div class="tip-quote">
    
    <div class="tip-text">Create <code>userId</code> and <code>anonymousId</code> lead fields in Marketo before you send events. RudderStack looks leads up, and creates them, through those fields, so events fail without them.</div>
  </div>
</blockquote>
<div class="rs-ckeys">
<div class="rs-ckey" id="track_anonymous_events">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">track_anonymous_events</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>boolean</code>
  </p><p class="rs-ckey__field">
    Default value:
    <code>false</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Send <code>track</code> events that have no <code>userId</code>. RudderStack then matches the lead by email, or by <code>anonymousId</code>.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li>When <code>false</code>, a <code>track</code> event without a <code>userId</code> fails.</li>
<li>The dashboard&rsquo;s note on this setting reads as though turning it on requires a <code>userId</code> on every <code>track</code> event. It&rsquo;s the other way round: turning it on is what lets events without one through.</li>
</ul>

</div>

<div class="rs-ckey__extra">
  See <a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/marketo/#custom-activity-settings" >Custom Activity Settings</a>.
</div>

</div>

<div class="rs-ckey" id="create_if_not_exist">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">create_if_not_exist</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>boolean</code>
  </p><p class="rs-ckey__field">
    Default value:
    <code>true</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Create a lead when no existing lead matches the event.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li>When <code>false</code>, an event without a matching lead fails.</li>
</ul>

</div>

</div>

</div>

<!-- end-chunk -->
<!-- begin-chunk -->
<h3 id="mappings">Mappings</h3><p>The three mapping keys connect your events to Marketo custom activities and lead fields. Create and approve each custom activity in Marketo first — see <a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/marketo/#how-do-i-create-a-custom-activity-in-marketo" >How do I create a custom activity in Marketo?</a>.</p>
<p>None of the mapping fields is validated locally, so Rudder CLI accepts a row with a field missing — and every field is a string.</p>
<div class="rs-ckeys">
<div class="rs-ckey" id="rudder_events_mapping">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">rudder_events_mapping</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>array of objects</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Maps <code>track</code> event names to Marketo custom activities. A <code>track</code> event without a row here fails, so Marketo receives only the events you map.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li><code>event</code> — RudderStack event name.</li>
<li><code>marketo_activity_id</code> — ID of the custom activity type, from Marketo&rsquo;s admin settings. A digit string: quote it, since an unquoted number fails validation.</li>
<li><code>marketo_primarykey</code> — event property whose value fills the activity&rsquo;s primary field. An event without a value for it fails.</li>
</ul>

</div>

<div class="rs-ckey__extra">
  <div class="rs-code">
  <div class="rs-code__head">yaml<button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">rudder_events_mapping:
  - event: Product Clicked
    marketo_activity_id: &#34;100001&#34;
    marketo_primarykey: product_id</code></pre></div>
</div>
<p>See <a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/marketo/#custom-events" >Custom events</a>.</p>
</div>

</div>

<div class="rs-ckey" id="custom_activity_property_map">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">custom_activity_property_map</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>array of objects</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Maps <code>track</code> event properties onto fields of the event&rsquo;s custom activity. The property named by <code>marketo_primarykey</code> fills the primary field and isn&rsquo;t sent through this map.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li><code>from</code> — event property name.</li>
<li><code>to</code> — API name of the custom activity field.</li>
</ul>

</div>

<div class="rs-ckey__extra">
  <div class="rs-code">
  <div class="rs-code__head">yaml<button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">custom_activity_property_map:
  - from: product_name
    to: productName</code></pre></div>
</div>
<p>See <a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/marketo/#custom-activity-property-map" >Custom activity property map</a>.</p>
</div>

</div>

<div class="rs-ckey" id="lead_trait_mapping">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">lead_trait_mapping</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>array of objects</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Maps <code>identify</code> traits onto Marketo lead fields. RudderStack already maps standard traits, such as <code>email</code>, <code>firstName</code>, and <code>phone</code>, on its own. Use this for custom fields, or to send a trait to a different field.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li><code>from</code> — trait name.</li>
<li><code>to</code> — API name of the lead field.</li>
</ul>

</div>

<div class="rs-ckey__extra">
  <div class="rs-code">
  <div class="rs-code__head">yaml<button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">lead_trait_mapping:
  - from: leadScore
    to: customLeadScore</code></pre></div>
</div>
<p>See <a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/marketo/#supported-mappings" >Supported mappings</a> for the traits RudderStack maps on its own.</p>
</div>

</div>

</div>

<!-- end-chunk -->
<!-- begin-chunk -->
<h3 id="per-source-keys">Per-source keys</h3><p>Both keys are objects keyed by the local source type — the tokens listed under <a href="#source-types" >Source types</a>. A key naming a source type this destination doesn&rsquo;t support fails validation.</p>
<div class="rs-ckeys">
<div class="rs-ckey" id="connection_mode">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">connection_mode</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>object</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Maps each source type you connect to the mode its events reach Marketo in, using the modes in <a href="#source-types" >Source types</a>.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li>An entry is required for each source type you connect — see <a href="#connect-a-source" >Connect a source</a>.</li>
</ul>

</div>

<div class="rs-ckey__extra">
  <div class="rs-code">
  <div class="rs-code__head">yaml<button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">connection_mode:
  web: cloud
  cloud: cloud</code></pre></div>
</div>

</div>

</div>

<div class="rs-ckey" id="consent_management">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">consent_management</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>object</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Consent provider configuration per source type. The entry shape, accepted providers, and the rules on <code>resolution_strategy</code> and <code>consents</code> are shared across all destination types — see <a href="https://www.rudderstack.com/docs/dev-tools/rudder-cli/destination-types/#consent-management" >Consent management</a>.
</p>

</div>

</div>

<!-- end-chunk -->
<!-- begin-chunk -->
<h2 id="source-types">Source types</h2><p>Marketo accepts events from these source types in the mentioned connection modes:</p>
<table>
  <thead>
      <tr>
          <th>Source type</th>
          <th>Connection mode</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><code>android</code></td>
          <td><code>cloud</code></td>
      </tr>
      <tr>
          <td><code>android_kotlin</code></td>
          <td><code>cloud</code></td>
      </tr>
      <tr>
          <td><code>ios</code></td>
          <td><code>cloud</code></td>
      </tr>
      <tr>
          <td><code>ios_swift</code></td>
          <td><code>cloud</code></td>
      </tr>
      <tr>
          <td><code>web</code></td>
          <td><code>cloud</code></td>
      </tr>
      <tr>
          <td><code>unity</code></td>
          <td><code>cloud</code></td>
      </tr>
      <tr>
          <td><code>react_native</code></td>
          <td><code>cloud</code></td>
      </tr>
      <tr>
          <td><code>flutter</code></td>
          <td><code>cloud</code></td>
      </tr>
      <tr>
          <td><code>cordova</code></td>
          <td><code>cloud</code></td>
      </tr>
      <tr>
          <td><code>cloud</code></td>
          <td><code>cloud</code></td>
      </tr>
      <tr>
          <td><code>warehouse</code></td>
          <td><code>cloud</code></td>
      </tr>
  </tbody>
</table>
<p>Every source type is <code>cloud</code> only — events reach Marketo from RudderStack&rsquo;s servers, never in device mode.</p>

<p><code>warehouse</code> is the token a <a href="https://www.rudderstack.com/docs/sources/reverse-etl/" >Reverse ETL source</a> resolves to. Rudder CLI manages the destination’s <code>warehouse</code> entry — if the destination is connected to a Reverse ETL source, set <code>connection_mode.warehouse: cloud</code> in its spec, or <code>apply</code> removes it.</p>
<p>Rudder CLI can also declare the Reverse ETL connection itself, for the types listed under <a href="https://www.rudderstack.com/docs/dev-tools/rudder-cli/yaml-retl-connections/#supported-destinations" >Supported destinations</a> — see <a href="https://www.rudderstack.com/docs/dev-tools/rudder-cli/retl-connections/" >Manage Reverse ETL Connections using Rudder CLI</a>.</p>

<html lang="en">
<blockquote class="info">
  <div class="tip-quote">
    
    <div class="tip-text">The dashboard additionally offers Marketo to AMP and Shopify sources. Rudder CLI doesn&rsquo;t manage those connections, so <code>amp</code> and <code>shopify</code> are invalid here.</div>
  </div>
</blockquote>

</html>
<!-- end-chunk -->
<!-- begin-chunk -->
<h2 id="connect-a-source">Connect a source</h2><p>An event stream connection to this destination is checked against two rules at <code>validate</code> time.</p>
<p><strong>The source&rsquo;s type must be supported.</strong> A source&rsquo;s type resolves to one of the tokens above before the check — a JavaScript source resolves to <code>web</code>, and webhook and server-side SDK sources resolve to <code>cloud</code>. Every type an event stream source can resolve to is supported here, so this check always passes.</p>
<p><strong>The destination config must carry a <code>connection_mode</code> entry for that source type.</strong> This lives on the destination spec, not on the <a href="https://www.rudderstack.com/docs/dev-tools/rudder-cli/yaml-connections/" >connection spec</a>. Without it:</p>
<div class="rs-code">
  <div class="rs-code__head"><button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-text" data-lang="text">destination &#39;marketo-prod&#39; config has no &#39;connection_mode&#39; entry for source type &#39;web&#39;</code></pre></div>
</div>
<p>Marketo needs no additional config keys to connect a source of any type.</p>
<!-- end-chunk -->
<!-- begin-chunk -->
<h2 id="secrets">Secrets</h2><p><code>client_id</code> and <code>client_secret</code> are the secret keys. Write each as a <code>{{ .VAR }}</code> reference and supply the value at apply time:</p>
<div class="rs-code">
  <div class="rs-code__head">yaml<button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">config:
  client_id: &#34;{{ .MARKETO_CLIENT_ID }}&#34;
  client_secret: &#34;{{ .MARKETO_CLIENT_SECRET }}&#34;</code></pre></div>
</div>
<div class="rs-code">
  <div class="rs-code__head">bash<button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-bash" data-lang="bash">export RUDDER_MARKETO_CLIENT_ID=&#34;...&#34;
export RUDDER_MARKETO_CLIENT_SECRET=&#34;...&#34;
rudder-cli apply

# or
rudder-cli apply --var-file secrets.vars.yaml</code></pre></div>
</div>
<p>Note that:</p>
<ul>
<li><code>rudder-cli import</code> writes only the secrets the API returns, as <code>{{ .VAR }}</code> references, and leaves the others out. Add any secret key it leaves out, then supply the variables before you apply — see <a href="https://www.rudderstack.com/docs/dev-tools/rudder-cli/destination-types/#secrets" >Secrets</a>.</li>
</ul>
<p>See <a href="https://www.rudderstack.com/docs/dev-tools/rudder-cli/variable-substitution/" >How to Use Variable Substitution in Rudder CLI</a>.</p>
<!-- end-chunk -->
<!-- begin-chunk -->
<h2 id="changes-by-release">Changes by release</h2>
<p>No changes since this type became available.</p>
<p>For changes across every destination type, see <a href="https://www.rudderstack.com/docs/dev-tools/rudder-cli/destination-types/changes/" >Destination Type Changes by Release</a>.</p>
<!-- end-chunk -->
<!-- begin-chunk -->
<h2 id="see-more">See more</h2><ul>
<li><a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/marketo/" >Marketo Destination</a> for the API service setup, custom activities, and the traits RudderStack maps on its own</li>
<li><a href="https://www.rudderstack.com/docs/dev-tools/rudder-cli/destination-types/" >Destination Type Reference for Rudder CLI</a> for the rules shared across destination types</li>
<li><a href="https://www.rudderstack.com/docs/dev-tools/rudder-cli/yaml-destinations/" >Destination YAML Reference</a> for the spec envelope</li>
</ul>

