Campaign Manager snapshot

A high-level look at Stitch's Campaign Manager integration, including release status, useful links, and the features supported in Stitch.

STITCH
Release Status

Released

Supported By

Singer Community

Stitch Plan

Free

Singer GitHub Repository

Campaign Manager Repository

DATA SELECTION
Table Selection

Supported

Column Selection

Unsupported

REPLICATION SETTINGS
Anchor Scheduling

Supported

Table-level Reset

Unsupported

Configurable Replication Methods

Unsupported

TRANSPARENCY
Extraction Logs

Supported

Loading Reports

Supported

Connecting Campaign Manager

Campaign Manager setup requirements

To set up Campaign Manager in Stitch, you need:

  • A Campaign Manager account. Refer to Google’s website for signup information.

  • API access. Most Campaign Manager accounts have this enabled by default. If you’re not sure, contact your DoubleClick representative or the Campaign Manager support team.

  • Access to the reports you want to replicate. Stitch will only be able to replicate the reports that the user who authorizes the integration has access to.

Step 1: Verify report access

Before you connect Campaign Manager to Stitch, you should verify that you have access to the reports you want to replicate. Stitch will only be able to replicate data for the same reports that you have access to in Campaign Manager.

  1. Sign into your Campaign Manager account and navigate to the Report Builder page.
  2. Under Reports, click My Reports.
  3. A list of all the reports you have access to will display:

    List of reports in Campaign Manager

  4. Verify that the reports you want to replicate are listed on this page.

Step 2: Locate your Campaign Manager profile ID

  1. Sign into your Campaign Manager account.
  2. Click the user menu (your icon) in the top right corner.
  3. In the dropdown beneath the Sign out button will be a list of the profiles you have access to.
  4. Locate the ID of the profile you want to connect. This will be a seven digit number next to the name of the profile. For example: 9999999

    An example is highlighted in the image to the right.

  5. Copy the profile ID.

Keep this handy - you’ll need it in the next step.

Step 3: Add Campaign Manager as a Stitch data source

  1. Sign into your Stitch account.
  2. On the Stitch Dashboard page, click the Add Integration button.

  3. Click the Campaign Manager icon.

  4. Enter a name for the integration. This is the name that will display on the Stitch Dashboard for the integration; it’ll also be used to create the schema in your destination.

    For example, the name “Stitch Campaign Manager” would create a schema called stitch_campaign_manager in the destination. Note: Schema names cannot be changed after you save the integration.

  5. In the Profile ID field, paste the ID of the Campaign Manager profile from Step 2. This value should be a seven digit number such as 9999999.

Step 4: Create a replication schedule

In the Replication Frequency section, you’ll create the integration’s replication schedule. An integration’s replication schedule determines how often Stitch runs a replication job, and the time that job begins.

Stitch offers two methods of creating a replication schedule:

  • Replication Frequency: This method requires selecting the interval you want replication to run for the integration. Start times of replication jobs are based on the start time and duration of the previous job. Refer to the Replication Frequency documentation for more information and examples.
  • Anchor scheduling: Based on the Replication Frequency, or interval, you select, this method “anchors” the start times of this integration’s replication jobs to a time you select to create a predictable schedule. Anchor scheduling is a combination of the Anchor Time and Replication Frequency settings, which must both be defined to use this method. Additionally, note that:

    • A Replication Frequency of at least one hour is required to use anchor scheduling.
    • An initial replication job may not begin immediately after saving the integration, depending on the selected Replication Frequency and Anchor Time. Refer to the Anchor Scheduling documentation for more information.

To keep your row usage low, consider setting the integration to replicate less frequently. See the Understanding and Reducing Your Row Usage guide for tips on reducing your usage.

Step 5: Authorize Stitch to access Campaign Manager

  1. If you aren’t already signed into your Google account, you’ll be prompted for your credentials.
  2. After you sign in, you’ll see a list of the permissions requested by Stitch:
    • View and manage DoubleClick for Advertisers reports - This is required to allow Stitch to view and run reports. Note: Stitch will not alter report settings, and will only ever read data. Refer to the Replication section below for more info.
  3. To grant access, click the Allow button.
  4. After you’ve granted access, you’ll be redirected back to Stitch to finish setting up the integration.

Step 6: Set tables to replicate

To complete the setup, you’ll need to select the tables you want to replicate to your data warehouse.

Check out the Schema section to learn more about the available tables in Campaign Manager and how they replicate.

  1. In the list of tables that displays - or in the Tables to Replicate tab, if you skipped this step during setup - locate a table you want to replicate.
  2. To track a table, click the checkbox next to the table’s name. A green checkmark means the table is set to replicate.

  3. Repeat this process for all the tables you want to replicate.
  4. When finished, click the Finalize Your Selections button at the bottom of the screen to save your selections.

Note: If you change these settings while a replication job is still in progress, they will not be used until the next job starts.

Initial and historical replication jobs

After you finish setting up Campaign Manager, its Sync Status may show as Pending on either the Stitch Dashboard or in the Integration Details page.

For a new integration, a Pending status indicates that Stitch is in the process of scheduling the initial replication job for the integration. This may take some time to complete.

Free historical data loads

The first seven days of replication, beginning when data is first replicated, are free. Rows replicated from the new integration during this time won’t count towards your quota. Stitch offers this as a way of testing new integrations, measuring usage, and ensuring historical data volumes don’t quickly consume your quota.


Campaign Manager Replication

When Stitch replicates data from Campaign Manager, the process will look like this:

  1. Stitch runs the selected report using the report’s defined date range and included dimensions and metrics.
  2. Campaign Manager creates a CSV file of the report results.
  3. Stitch replicates the results from the CSV.

Each run of a report will have its own CSV file in Campaign Manager, which you can access by signing into your Campaign Manager account.

Report date ranges

When Stitch replicates data for a given report, it will use the date range currently defined in Campaign Manager for that report.

For example: The image below shows the configuration for a report named ad_performance_report, where the date range is set to the last 30 days. When Stitch replicates data for this report, it will run the report using these settings:

Report date range field highlighted in Campaign Manager

Data loading and Append-Only Replication

When Stitch loads the extracted data into your destination, it will do so using Append-Only Replication. This is a type of Incremental Replication where existing rows aren’t updated, but appended to the end of the table.

Additionally, the number of rows loaded into the table during each replication job is dependent on the combination of unique values in the dimension columns you track. See the Column Selection and Statistic Aggregation section for more info and examples.

Example

Let’s say these columns are tracking in the ad_performance_report table:

  • date (dimension) - The date pertaining to the record.

  • campaignId (dimension) - This is the ID associated with a campaign. In this example, there are two campaigns: 929007494 and 929599581
  • device (dimension) - The device type. There are two values for this example: Computer and Tablet
  • impressions (metric) - The total number of impressions.

Every time Stitch replicates and loads data, a row for each unique combination of the dimension columns will be appended to the end of the table:

_sdc_report_datetime date   campaignId device impressions
2017-10-01 17:48:26.791 2017-09-10 00:00:00   929007494 Computer 61
2017-10-01 17:48:26.791 2017-09-10 00:00:00   929007494 Tablet 15
2017-10-01 17:48:26.791 2017-09-10 00:00:00   929599581 Computer 37
2017-10-01 17:48:26.791 2017-09-10 00:00:00   929599581 Tablet 9

Query for the latest data

If you want only the most recently replicated data for any Campaign Manager table, you can use the sample query below to account for the Append-Only Replication Stitch uses.

This query will use the report’s Dimensions and the _sdc_report_datetime column to return the latest data:

SELECT *
  FROM (
        SELECT *,
        RANK() OVER (PARTITION BY dimension_1, dimension_2, etc., 
                     ORDER BY _sdc_report_datetime DESC)
        FROM ad_performance_report
        ORDER BY dimension_1, dimension_2, etc. ASC
       ) AS latest
 WHERE latest.rank = 1

In this query:

  1. A subquery first uses a window function to create a ‘window’ of data for each combination of Dimensions,
  2. The values of the _sdc_report_datetime column are ranked within each window partition, and
  3. Then, in the outer query, only the rows with _sdc_report_datetime values ranked as 1 - which is equal to the maximum timestamp - are returned.

Campaign Manager table schemas

[sample_report_table]

Replication Method :

Append-Only (Key-based Incremental)

Replication Key :
Primary Key :

__sdc_primary_key

For each report you set to replicate, Stitch will create a table in your destination. The name of the report will be the name of the destination table, with some light transformations to ensure the table name adheres to your destination’s naming rules.

For example: A report named Ad Performance Report in Campaign Manager may result in a table named ad_performance_report or AD_PERFORMANCE_REPORT, depending on your destination.

__sdc_primary_key
STRING

Applicable only if Stitch doesn’t detect a Primary Key in the source table. Stitch will use this column to de-dupe data.

_sdc_report_datetime
DATE-TIME

The start time of the Stitch replication job that replicated this record.

Dimensions

The Dimensions you include in your Campaign Manager report will display in the table, one column for each Dimension.

Metrics

The Metrics you include in your Campaign Manager report will display in the table, one column for each Metric.



Questions? Feedback?

Did this article help? If you have questions or feedback, feel free to submit a pull request with your suggestions, open an issue on GitHub, or reach out to us.