# Apple Search Ads

## Pipeline Concepts

Before setting up the pipeline, learn about pipeline concepts [here](https://docs.sprinkledata.com/product/ingesting-your-data/pipelines)

## Step by Step Guide

### STEP-1: Configure Connection

To learn about Connection, refer [here](https://docs.sprinkledata.com/product/ingesting-your-data/pipelines)

* Log into Sprinkle application
* Navigate to Ingest -> Connections Tab -> New Connection ->&#x20;
* Select Apple Search Ads
* Provide all the mandatory details
  * *Name*: Name to identify this connection
  * *Client Id*: To generate Client ID, refer to this [docs](https://developer.apple.com/documentation/apple_search_ads/implementing_oauth_for_the_apple_search_ads_api)
  * *Client Secret*: To generate Client Secret, Refer to this [docs](https://developer.apple.com/documentation/apple_search_ads/implementing_oauth_for_the_apple_search_ads_api)
  * *Advance Settings:* Refer [here](#advanced-connection-settings)
* Test Connection
* Create

### STEP-2: Configure Pipeline

To learn about Pipeline, refer [here](https://docs.sprinkledata.com/product/ingesting-your-data/pipelines)

* Navigate to Import -> Pipeline -> Add ->&#x20;
* Select Apple Search Ads
* Provide the name -> Create
* **Connection Tab**:&#x20;
  * From the drop-down, select the name of connection created in STEP-2
  * Update

### STEP-3: Create Dataset

**Datasets Tab**: To learn about Dataset, refer [here](https://docs.sprinkledata.com/product/ingesting-your-data/pipelines). Add Dataset for each report/dataset that you want to integrate, providing following details

* *Org* (Required) : Select the Org Id from the drop-down
* *Report Type* (Required) : Select the API through which you want the result. Read more from apple search ads api [docs](https://developer.apple.com/documentation/apple_search_ads). Select report type from any one of the following:
  * *User\_ACL*
  * *Campaigns*
  * *Budget\_Orders*
  * *Ad\_Groups*
    * *Campaigns*: Select from the drop-down
  * *Campaign\_Negative\_Keywords*
    * *Campaigns*: Select from the drop-down
  * *Geolocation*
  * *Device\_Sizes*
  * *Campaign\_Level\_Report*
    * *Start Date*: Start Date from which you want to fetch data. Give Start Date in Format yyyy-mm-dd
    * *Window for Backfill*: Mention window for backfill, for backfilling metrics in every run to include updates from attribution window. Can take values 1, 7 and 28.
  * *Ad\_Group\_Level\_Report*
    * *Campaigns*: Select from the drop-down
    * *Start Date*: Start Date from which you want to fetch data. Give Start Date in Format yyyy-mm-dd
    * *Window for Backfill*: Mention window for backfill, for backfilling metrics in every run to include updates from attribution window. Can take values 1, 7 and 28.
  * *Keyword\_Level\_Report*
    * *Campaigns*: Select from the drop-down
    * *Start Date*: Start Date from which you want to fetch data. Give Start Date in Format yyyy-mm-dd
    * *Window for Backfill*: Mention window for backfill, for backfilling metrics in every run to include updates from attribution window. Can take values 1, 7 and 28.
  * *Search\_Term\_Level\_Report*
    * *Campaigns*: Select from the drop-down
    * *Start Date*: Start Date from which you want to fetch data. Give Start Date in Format yyyy-mm-dd
    * *Window for Backfill*: Mention window for backfill, for backfilling metrics in every run to include updates from attribution window. Can take values 1, 7 and 28.
  * *Creative\_Set\_Level\_Report*
    * *Campaigns*: Select from the drop-down
    * *Start Date*: Start Date from which you want to fetch data. Give Start Date in Format yyyy-mm-dd
    * *Window for Backfill*: Mention window for backfill, for backfilling metrics in every run to include updates from attribution window. Can take values 1, 7 and 28.
* Flatten Level(Required) : Select One Level or Multi Level. In one level, flattening will not be applied on complex type. They will be stored as string. In multi level, flattening will be applied in complex level till they become simple type.
* *Destination Schema* (Required) : Data warehouse schema where the table will be ingested into
* *Destination Table name* (Required) : It is the table name to be created on the warehouse. If not given, sprinkle will create like ds\_\<pipelinename>\_\<tablename>
* *Destination Create Table Clause*: Provide additional clauses to warehouse-create table queries such as clustering, partitioning, and more, useful for optimizing DML statements. [Learn more](https://docs.sprinkledata.com/product/ingesting-your-data/pipelines/databases/features/destination-create-table-clause) on how to use this field.
* Create

### STEP-4: Run and schedule Ingestion

In the **Ingestion Jobs** ta&#x62;**:**

* Trigger the Job, using Run button
* To schedule, enable Auto-Run. Change the frequency if required

### Advanced Connection Settings

* **API Read Timeout (In seconds) :**  Maximum time of inactivity between two data packets when waiting for the server's response. The default value is 30 seconds.
* **API Connection Timeout (In seconds) :** Time period within which a connection between a client and a server must be established.
* **Retry Limit :** Number of retries allowed when an API call fails. For example if an API call fails and retry limit is 5 then it will check 5 times for that API call and if it succeeded then it will stop checkin&#x67;**.**
* **Retry Sleep Time (In milliseconds) :** Given time, after which retry should happen in case an API call fails.
* **Incremental Batch Size (In days) :** No. of days in one batch for which data is being downloaded during incremental ingestion.
* **Version :** It gives information about the version of Apple Search Ads API being used.
* **Timezone** **:** Enter the applicable timezone from the dropdown.

### Dataset Fields

<details>

<summary>User_ACL</summary>

* orgName
* orgId&#x20;
* currency&#x20;
* timeZone&#x20;
* paymentModel&#x20;
* roleNames\_Admin&#x20;
* parentOrgId&#x20;
* displayName

</details>

<details>

<summary>Campaigns</summary>

* adamId&#x20;
* adChannelType&#x20;
* billingEvent&#x20;
* budgetAmount&#x20;
* budgetOrders&#x20;
* countriesOrRegions&#x20;
* countryOrRegionServingStateReasons&#x20;
* dailyBudgetAmount&#x20;
* deleted&#x20;
* displayStatus&#x20;
* endTime&#x20;
* id&#x20;
* locInvoiceDetails&#x20;
* modificationTime&#x20;
* name&#x20;
* orgId&#x20;
* paymentModel&#x20;
* paymentModel&#x20;
* servingStatus&#x20;
* startTime&#x20;
* status&#x20;
* supplySources

</details>

<details>

<summary>Budget_Orders</summary>

* id&#x20;
* name&#x20;
* startDate&#x20;
* endDate&#x20;
* budget\_amount&#x20;
* budget\_currency&#x20;
* orderNumber&#x20;
* clientName&#x20;
* primaryBuyerEmail&#x20;
* billingEmail&#x20;
* status&#x20;
* parentOrgId&#x20;
* supplySources

</details>

<details>

<summary>Ad_Groups</summary>

* automatedKeywordsOptIn&#x20;
* campaignId&#x20;
* cpaGoal&#x20;
* defaultBidAmount&#x20;
* deleted&#x20;
* displayStatus&#x20;
* endTime&#x20;
* id&#x20;
* modificationTime&#x20;
* name&#x20;
* orgId&#x20;
* paymentModel&#x20;
* pricingModel&#x20;
* servingStateReasons&#x20;
* servingStatus&#x20;
* startTime&#x20;
* status&#x20;
* targetingDimensions

</details>

<details>

<summary>Campaign_<em>Negative</em>_Keywords</summary>

* id
* campaignId&#x20;
* adGroupId&#x20;
* text&#x20;
* status&#x20;
* matchType&#x20;
* modificationTime&#x20;
* deleted

</details>

<details>

<summary>Geolocation</summary>

* id&#x20;
* entity&#x20;
* displayName&#x20;
* countryOrRegion&#x20;
* adminArea&#x20;
* locality

</details>

<details>

<summary>Device_Sizes</summary>

* ipadPro&#x20;
* iphone6+&#x20;
* iphone\_5\_8&#x20;
* iphone5&#x20;
* iphone6&#x20;
* ipadPro\_2018&#x20;
* ipad&#x20;
* iphone\_6\_5&#x20;
* ipad\_10\_5

</details>

<details>

<summary>Campaign_Level_Report</summary>

* other&#x20;
* granularity\_impressions&#x20;
* granularity\_taps&#x20;
* installs
* &#x20;granularity\_newDownloads
* &#x20;granularity\_redownloads
* &#x20;granularity\_latOnInstalls
* &#x20;granularity\_latOffInstalls
* &#x20;granularity\_ttr
* granularity\_avgCPA \_amount
* granularity\_avg\_CPA\_currency
* granularity\_avgCPT *amount*
* *granularity* avgCPT\_ currency
* &#x20;granularity\_ avgCPM *amount*
* *granularity\_avgCPM\_currency*
* &#x20;*granularity* localSpend \_amount
* granularity\_localcurrency
* &#x20;granularity\_conversionRate
* granularity\_date
* metadata\_ adChannelType
* metadata\_billingEvent
* &#x20;metadata\_ supplySources
* metadata\_campaignId
* &#x20;metadata\_campaignName&#x20;
* metadata\_deleted&#x20;
* metadata\_campaignStatus
* &#x20;metadata\_app\_appName
* &#x20;metadata\_app\_ adamId&#x20;
* &#x20;metadata\_servingStatus
* &#x20;metadata\_ servingStateReasons
* metadata\_countriesOrRegions
* metadata\_modificationTime
* metadata\_totalBudget\_amount
* metadata\_totalBudget\_currency
* metadata\_dailyBudget\_amount
* metadata\_dailyBudget\_currency
* metadata\_displayStatus
* &#x20;metadata\_orgId
* metadata\_countryOrRegionServingStateReasons
* &#x20;metadata\_countryOrRegion
* &#x20;metadata\_deviceClass

</details>

<details>

<summary>Ad_Group_Level_Report</summary>

* other&#x20;
* granularity\_impressions&#x20;
* granularity\_taps&#x20;
* granularity\_installs&#x20;
* granularity\_newDownloads&#x20;
* granularity\_redownloads&#x20;
* granularity\_latOnInstalls&#x20;
* granularity\_latOffInstalls&#x20;
* granularity\_ttr&#x20;
* granularity\_avgCPA\_amount&#x20;
* granularity\_avgCPA\_currency&#x20;
* granularity\_avgCPT\_amount&#x20;
* granularity\_avgCPT\_currency&#x20;
* granularity\_avgCPM\_amount&#x20;
* granularity\_avgCPM\_currency&#x20;
* granularity\_localSpend\_amount&#x20;
* granularity\_localSpend\_currency&#x20;
* granularity\_conversionRate&#x20;
* granularity\_date&#x20;
* metadata\_adGroupId&#x20;
* metadata\_adGroupName&#x20;
* metadata\_startTime&#x20;
* metadata\_endTime&#x20;
* metadata\_cpaGoal&#x20;
* metadata\_pricingModel&#x20;
* metadata\_defaultBidAmount\_amount&#x20;
* metadata\_defaultBidAmount\_currency&#x20;
* deleted&#x20;
* adGroupStatus&#x20;
* adGroupServingStatus&#x20;
* adGroupServingStateReasons&#x20;
* modificationTime&#x20;
* automatedKeywordsOptIn&#x20;
* adGroupDisplayStatus&#x20;
* campaignId&#x20;
* orgId&#x20;
* countryOrRegion&#x20;
* deviceClass

</details>

<details>

<summary>Keyword_Level_Report</summary>

* other&#x20;
* total\_impressions&#x20;
* total\_taps&#x20;
* total\_installs&#x20;
* total\_newDownloads&#x20;
* total\_redownloads&#x20;
* total\_latOnInstalls&#x20;
* total\_latOffInstalls&#x20;
* total\_ttr&#x20;
* total\_avgCPA\_amount&#x20;
* total\_avgCPA\_currency&#x20;
* total\_avgCPT\_amount&#x20;
* total\_avgCPT\_currency&#x20;
* total\_avgCPM\_amount&#x20;
* total\_avgCPM\_currency&#x20;
* total\_localSpend\_amount&#x20;
* total\_localSpend\_currency
* total\_conversionRate&#x20;
* metadata\_keywordId&#x20;
* metadata\_keyword&#x20;
* metadata\_keywordStatus&#x20;
* metadata\_matchType&#x20;
* metadata\_bidAmount\_amount&#x20;
* metadata\_bidAmount\_currency&#x20;
* deleted&#x20;
* keywordDisplayStatus&#x20;
* adGroupId&#x20;
* adGroupName&#x20;
* adGroupDeleted&#x20;
* modificationTime&#x20;
* insights\_bidRecommendation\_bidMin\_amount&#x20;
* insights\_bidRecommendation\_bidMin\_currency&#x20;
* insights\_bidRecommendation\_bidMax\_amount&#x20;
* insights\_bidRecommendation\_bidMax\_currency&#x20;
* grandTotals\_other&#x20;
* grandTotals\_total\_impressions&#x20;
* grandTotals\_total\_taps&#x20;
* grandTotals\_total\_installs&#x20;
* grandTotals\_total\_newDownloads&#x20;
* grandTotals\_total\_redownloads&#x20;
* grandTotals\_total\_latOnInstalls&#x20;
* grandTotals\_total\_latOffInstalls&#x20;
* grandTotals\_total\_ttr&#x20;
* grandTotals\_total\_avgCPA\_amount&#x20;
* grandTotals\_total\_avgCPA\_currency&#x20;
* grandTotals\_total\_avgCPT\_amount&#x20;
* grandTotals\_total\_avgCPT\_currency&#x20;
* grandTotals\_total\_avgCPM\_amount&#x20;
* grandTotals\_total\_avgCPM\_currency&#x20;
* grandTotals\_total\_localSpend\_amount&#x20;
* grandTotals\_total\_localSpend\_currency
* grandTotals\_total\_conversionRate

</details>

<details>

<summary>Search_<em>Term</em>_Level_Report</summary>

* other&#x20;
* total\_impressions&#x20;
* total\_taps&#x20;
* total\_installs&#x20;
* total\_newDownloads&#x20;
* total\_redownloads&#x20;
* total\_latOnInstalls&#x20;
* total\_latOffInstalls&#x20;
* total\_ttr&#x20;
* total\_avgCPA\_amount&#x20;
* total\_avgCPA\_currency&#x20;
* total\_avgCPT\_amount&#x20;
* total\_avgCPT\_currency&#x20;
* total\_avgCPM\_amount&#x20;
* total\_avgCPM\_currency&#x20;
* total\_localSpend\_amount&#x20;
* total\_localSpend\_currency&#x20;
* total\_conversionRate
* metadata\_keywordId&#x20;
* metadata\_keyword&#x20;
* metadata\_keywordStatus&#x20;
* metadata\_matchType&#x20;
* metadata\_bidAmount\_amount&#x20;
* metadata\_bidAmount\_currency&#x20;
* deleted&#x20;
* keywordDisplayStatus&#x20;
* adGroupId&#x20;
* adGroupName&#x20;
* adGroupDeleted&#x20;
* searchTermText&#x20;
* countryOrRegion&#x20;
* searchTermSource&#x20;
* grandTotals\_other&#x20;
* grandTotals\_total\_impressions&#x20;
* grandTotals\_total\_taps&#x20;
* grandTotals\_total\_installs&#x20;
* grandTotals\_total\_newDownloads&#x20;
* grandTotals\_total\_redownloads&#x20;
* grandTotals\_total\_latOnInstalls&#x20;
* grandTotals\_total\_latOffInstalls&#x20;
* grandTotals\_total\_ttr&#x20;
* grandTotals\_total\_avgCPA\_amount&#x20;
* grandTotals\_total\_avgCPA\_currency&#x20;
* grandTotals\_total\_avgCPT\_amount&#x20;
* grandTotals\_total\_avgCPT\_currency&#x20;
* grandTotals\_total\_avgCPM\_amount&#x20;
* grandTotals\_total\_avgCPM\_currency&#x20;
* grandTotals\_total\_localSpend\_amount&#x20;
* grandTotals\_total\_localSpend\_currency&#x20;
* grandTotals\_total\_conversionRate

</details>

<details>

<summary>Creative_<em>Set</em>_Level_Report</summary>

* other&#x20;
* total\_impressions&#x20;
* total\_taps&#x20;
* total\_installs&#x20;
* total\_newDownloads&#x20;
* total\_redownloads&#x20;
* total\_latOnInstalls&#x20;
* total\_latOffInstalls&#x20;
* total\_ttr&#x20;
* total\_avgCPA\_amount&#x20;
* total\_avgCPA\_currency&#x20;
* total\_avgCPT\_amount&#x20;
* total\_avgCPT\_currency&#x20;
* total\_avgCPM\_amount&#x20;
* total\_avgCPM\_currency&#x20;
* total\_localSpend\_amount&#x20;
* total\_localSpend\_currency&#x20;
* total\_conversionRate&#x20;
* metadata\_creativeSetId&#x20;
* metadata\_creativeSetName&#x20;
* metadata\_displayStatus
* metadata\_creativeSetLanguageDisplayName&#x20;
* metadata\_deleted&#x20;
* metadata\_status&#x20;
* metadata\_orgId&#x20;
* metadata\_campaignId&#x20;
* metadata\_adGroupId&#x20;
* metadata\_adGroupCreativeSetId&#x20;
* metadata\_creationTime&#x20;
* metadata\_modificationTime&#x20;
* metadata\_adFormat

</details>
