Data Connector for Marketo

You can import Marketo data into Treasure Data. Then, in Treasure Data, integrate the data with your other data sources.

You use this same connector to send job results to Marketo. See export to Marketo.

Table of Contents


  • Basic knowledge of Treasure Data
  • There is a daily quota of 500MB Bulk Extract per day. If you reach the limit, we recommend that you reduce the date range, or contact Marketo account manager and pay for additional space.

From the GUI: Web console

You can import Marketo data from GUI console.

Step 1: Create a new connection

Visit Treasure Data Connections, search and select Marketo.

The dialog opens.

Complete the new connection information, providing your Marketo credential. Refer to Appendix B for information on where to find your credential information.

  • Marketo Account ID (required): This is your Marketo Service/Munchkin ID.
  • Marketo Client ID (required): This is service specific client id.
  • Marketo Client Secret (required): This is service specific client secret.

You can give a name to your newly created connection and save it for later use

2. Click ‘New Transfer’ from my connections.

3. Select the desired target i.e ‘Leads’.

Supported target types are Lead, Activity, Lead by Static List, Member by Program, Campaign.

4. Configuration for Specific Targets

1. Bulk extract targets

Bulk extracts target are exported using Marketo Bulk Extract API.

Bulk extract have the following common configuration:

From date: Data that have createdAt or updatedAt filter after the specified date.

Fetch days: The To date is calculated using From day + Fetch days

Escape character: Marketo CSV file escape character

Quote character: Marketo CSV file quote character

Limitation: – Bulk extract target preview shows only mock data.

1. Lead.

Lead data is exported using bulk extract. Some Marketo account have the updatedAt feature enabled for Lead, which allows bulk extract query to do incremental export by Lead. You can select the checkbox Use "updatedAt"? to filter by the updatedAt column.

2. Activity.

Activity data is exported using bulk extract. Marketo activity attributes are exported to the column attributes. This column is in JSON format.

Example of attributes

1. REST API targets

REST API targets are exported using Marketo REST API call.

1. Lead by static list.

Exported Lead data includes the column listId which contains the Lead list id.

2. Member by program.

Exported Lead data includes the column programId which contains the Lead list id.

3. Campaign.

Exported Marketo Campaign data.

4. Preview the table and the data to be imported.

5. Specify the target Database and Table to be imported. Select ‘Append’ or ‘Replace’. Select ‘processed_time’ as time-key for ‘Lead’.

6. Set a schedule if you want to. Import starts when the scheduled time comes, or starts immediately if you choose ‘Once now’.

7. Confirm that the job is running from Jobs page.

The daily quota of Bulk Extract is 500MB for all methods of transfer. When this limit is reached, we recommend that you reduce the date range, or contact Marketo account manager and pay for additional space.

From the CLI: Step 0: Install ‘td’ command v0.11.9 or later

Install the most current Treasure Data Toolbelt.

$ td --version

Set up config for the Marketo Leads

Guess and Preview are supported for Leads within List, Leads within Program.

Step 1: Create Seed Config File (seed.yml)

First, prepare seed.yml as shown in the following example for Marketo Leads. The parameters like account_id, client_id and client_secret are available at "Admin" > "Web Services" page in Marketo. You will use replace mode:

If needed, you can find more detailed information on getting access to your credentials in Marketo’s documentation:

  type: marketo
  target: lead
  account_id: ACCOUNT_ID
  client_id: CLIENT_ID
  client_secret: CLIENT_SECRET
  from_date: 2017-09-01
  fetch_days: 1
  type: stdout

A detailed list of options are available here.

For more details on available out modes, see Appendix A.

Step 2: Guess Fields (Generate load.yml)

Second, use connector:guess. This command automatically reads the target file and assesses(uses logic to guess) the file format. and output to load.yml. The file load.yml will include a schema for Lead.

$ td connector:guess seed.yml -o load.yml

If you open up load.yml, you’ll see assessed file format definitions including, in some cases, file formats, encodings, column names, and types.

Then you can preview how the system will parse the file by using preview command.

$ td connector:preview load.yml

If the system detects your column name or type incorrectly, modify load.yml directly and preview again.

Currently, the Data Connector supports parsing of "boolean", "long", "double", "string", and "timestamp" types.

Step 3: Execute Load Job

Finally, submit the load job. It may take a couple of hours depending on the data size. Users need to specify the database and table where their data is stored.

$ td connector:issue load.yml \
    --database td_sample_db \
    --table td_sample_table \
    --time-column activity_date_time

The connector:issue command assumes you have already created a database(td_sample_db) and a table(td_sample_table). If the database or the table do not exist in TD, this command will fail, so create the database and table manually or use --auto-create-table option with td connector:issue command to auto create the database and table:

$ td connector:issue load.yml \
    --database td_sample_db \
    --table td_sample_table \
    --time-column activity_date_time \
You can assign a Time Format column to the "Partitioning Key" by using the "--time-column" option.

Scheduled execution

You can schedule periodic data connector execution for periodic Marketo import. We take great care in distributing and operating our scheduler in order to achieve high availability. By using this feature, you no longer need a cron daemon on your local data center.

For the scheduled import, Data Connector for Marketo imports all records.

Create the schedule

A new schedule can be created by using the td connector:create command. The name of the schedule, cron-style schedule, the database and table where their data will be stored, and the Data Connector configuration file are required.

$ td connector:create \
    daily_marketo_leads_import \
    "10 0 * * *" \
    td_sample_db \
    td_sample_table \
The `cron` parameter also accepts three special options: `@hourly`, `@daily` and `@monthly`. For more detail on Scheduled Jobs

By default, schedule is setup in UTC timezone. You can set the schedule in a timezone using -t or —timezone option. Note that --timezone option supports only extended timezone formats like ‘Asia/Tokyo’, ‘America/Los_Angeles’ etc. Timezone abbreviations like PST, CST are not supported and may lead to unexpected schedules.

List the Schedules

You can see the list of currently scheduled entries by td connector:list.

$ td connector:list
| Name                              | Cron          | Timezone | Delay | Database        | Table                |
| daily_marketo_leads_import | 10 0 * * *    | UTC      | 0     | td_sample_table | sample_table         |

Show the Setting and History of Schedules

td connector:show shows the execution setting of a schedule entry.

% td connector:show daily_marketo_leads_import
Name     : daily_marketo_leads_import
Cron     : 10 0 * * *
Timezone : UTC
Delay    : 0
Database : td_sample_db
Table    : td_sample_table

td connector:history shows the execution history of a schedule entry. To investigate the results of each individual execution, use td job <jobid>.

% td connector:history daily_marketo_leads_import
| JobID  | Status  | Records | Database     | Table           | Priority | Started                   | Duration |
| 578066 | success | 10000   | td_sample_db | td_sample_table | 0        | 2015-04-18 00:10:05 +0000 | 160      |
| 577968 | success | 10000   | td_sample_db | td_sample_table | 0        | 2015-04-17 00:10:07 +0000 | 161      |
| 577914 | success | 10000   | td_sample_db | td_sample_table | 0        | 2015-04-16 00:10:03 +0000 | 152      |
| 577872 | success | 10000   | td_sample_db | td_sample_table | 0        | 2015-04-15 00:10:04 +0000 | 163      |
| 577810 | success | 10000   | td_sample_db | td_sample_table | 0        | 2015-04-14 00:10:04 +0000 | 164      |
| 577766 | success | 10000   | td_sample_db | td_sample_table | 0        | 2015-04-13 00:10:04 +0000 | 155      |
| 577710 | success | 10000   | td_sample_db | td_sample_table | 0        | 2015-04-12 00:10:05 +0000 | 156      |
| 577610 | success | 10000   | td_sample_db | td_sample_table | 0        | 2015-04-11 00:10:04 +0000 | 157      |
8 rows in set

Delete the Schedule

td connector:delete removes the schedule.

$ td connector:delete daily_marketo_leads_import

Appendix A

A) Modes for out plugin

You can specify file import mode in out section of seed.yml.

append (default)

This is the default mode and records are appended to the target table.

  mode: append

replace (In td 0.11.10 and later)

This mode replaces data in the target table. Note that any manual schema changes made to the target table remain intact with this mode.

  mode: replace

Appendix B: Marketo’s Munchkin Account information

Access to your API-enabled account is required before you can access the API. The Munchkin Account ID can be retrieved from the Marketo Admin page.

Steps to enable and create a new account for API access

1.Create an API Only User here.

2.Create an API Only User Role here.

Last modified: Jan 17 2018 19:33:36 UTC

If this article is incorrect or outdated, or omits critical information, let us know. For all other issues, access our support channels.