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

# Google Sheets

> Integrating Google Sheets with our platform allows you to seamlessly import and analyze marketing cost data.

export const CostsOptionalFields = () => <>
    <ResponseField name={costDefinitions.campaign.name} type={costDefinitions.campaign.dataType}>
      {costDefinitions.campaign.description}
      <br /><br />
      <strong>Example:</strong> {costDefinitions.campaign.example}
    </ResponseField>
    <ResponseField name={costDefinitions.campaignId.name} type={costDefinitions.campaignId.dataType}>
      {costDefinitions.campaignId.description}
      <br /><br />
      <strong>Example:</strong> {costDefinitions.campaignId.example}
    </ResponseField>
  </>;

export const CostsRequiredFields = () => <>
    <ResponseField name={costDefinitions.date.name} type={costDefinitions.date.dataType} required={costDefinitions.date.required}>
      {costDefinitions.date.description}
      <br /><br />
      <strong>Format:</strong> {costDefinitions.date.format}<br />
      <strong>Example:</strong> {costDefinitions.date.example}
    </ResponseField>
    <ResponseField name={costDefinitions.channel.name} type={costDefinitions.channel.dataType} required={costDefinitions.channel.required}>
      {costDefinitions.channel.description}
      <br /><br />
      <strong>Example:</strong> {costDefinitions.channel.example}
    </ResponseField>
    <ResponseField name={costDefinitions.channelGroup.name} type={costDefinitions.channelGroup.dataType} required={costDefinitions.channelGroup.required}>
      {costDefinitions.channelGroup.description}
      <br /><br />
      <strong>Example:</strong> {costDefinitions.channelGroup.example}
    </ResponseField>
    <ResponseField name={costDefinitions.cost.name} type={costDefinitions.cost.dataType} required={costDefinitions.cost.required}>
      {costDefinitions.cost.description}
      <br /><br />
      <strong>Example:</strong> {costDefinitions.cost.example}
    </ResponseField>
    <ResponseField name={costDefinitions.country.name} type={costDefinitions.country.dataType} required={costDefinitions.country.required}>
      {costDefinitions.country.description}
      <br /><br />
      <strong>Format:</strong> {costDefinitions.country.format}<br />
      <strong>Example:</strong> {costDefinitions.country.example}
    </ResponseField>
    <ResponseField name={costDefinitions.currency.name} type={costDefinitions.currency.dataType} required={costDefinitions.currency.required}>
      {costDefinitions.currency.description}
      <br /><br />
      <strong>Format:</strong> {costDefinitions.currency.format}<br />
      <strong>Example:</strong> {costDefinitions.currency.example}
    </ResponseField>
  </>;

export const costDefinitions = {
  "date": {
    "dataType": "date",
    "description": "Date of the campaign data (YYYY-MM-DD according to ISO8601).",
    "format": "ISO 8601",
    "example": "2025-02-20",
    "externalId": "DATE",
    "name": "date",
    "optional": "❌",
    "required": true
  },
  "campaign": {
    "dataType": "string",
    "description": "Name of the campaign.",
    "format": "",
    "example": "Summer Sale 2025",
    "externalId": "CAMPAIGN",
    "name": "campaign",
    "optional": "✔",
    "required": false
  },
  "channel": {
    "dataType": "string",
    "description": "Marketing channel used.",
    "format": "",
    "example": "Facebook",
    "externalId": "CHANNEL",
    "name": "channel",
    "optional": "❌",
    "required": true
  },
  "channelGroup": {
    "dataType": "string",
    "description": "Group classification of the channel.",
    "format": "",
    "example": "Social paid",
    "externalId": "CHANNEL_GROUP",
    "name": "channelGroup",
    "optional": "❌",
    "required": true
  },
  "cost": {
    "dataType": "number",
    "description": "Total cost associated with the campaign.",
    "format": "Decimal",
    "example": "1500",
    "externalId": "COST",
    "name": "cost",
    "optional": "❌",
    "required": true
  },
  "country": {
    "dataType": "string",
    "description": "Targeted country (2 letters).",
    "example": "SE",
    "externalId": "COUNTRY",
    "format": "ISO 3166",
    "name": "country",
    "optional": "❌",
    "required": true
  },
  "currency": {
    "dataType": "string",
    "description": "Currency of the cost data (3 letters).",
    "example": "SEK",
    "externalId": "CURRENCY",
    "format": "ISO 4217",
    "name": "currency",
    "optional": "❌",
    "required": true
  },
  "campaignId": {
    "dataType": "string",
    "description": "Unique identifier for the campaign.",
    "example": "camp_12345",
    "externalId": "CAMPAIGN_ID",
    "format": "",
    "name": "campaignId",
    "optional": "✔",
    "required": false
  }
};

### Supported data types

<CardGroup cols={2}>
  <Card title="Marketing cost" icon="dollar-sign">
    Ad spend and performance metrics
  </Card>
</CardGroup>

## Prerequisites

* A Google Sheets document shared with view access to `tag@dema.ai`
* The URL of your Google Sheets document

## Step-by-step integration guide

<Steps>
  <Step title="Create the Google Sheet">
    Create your Google Sheet according to the required [schema](#schema). Ensure that all necessary data fields are accurately populated in the correct format.

    For reference, you can review and follow the structure of this [example Google Sheet](https://docs.google.com/spreadsheets/d/1_9O7jSw23T5zylZ3ZvAxeaTyjNgFooPRRAoJqdhkKoc/edit?usp=sharing).
  </Step>

  <Step title="Verify channel values">
    Before sharing the sheet, ensure that the values in the **channel** and **channel group** columns match the available options listed in our [available values](#available-values) section. These values are not case-sensitive.
  </Step>

  <Step title="Share the Google Sheet">
    Once your Google Sheet is set up according to the schema and the **channel** and **channel group** values are correctly populated, share the sheet with view access to `tag@dema.ai`.
  </Step>

  <Step title="Send the spreadsheet URL">
    Copy the Spreadsheet URL and send it to your Customer Success Manager or support team. This URL will be used to integrate your Google Sheets data with our platform.
  </Step>
</Steps>

## Schema

Marketing cost data for campaign tracking and ROI analysis.

<Tip>
  The `channel` and `channelGroup` fields must match one of the [available channel values](#channel-groups--channels). Values are case-insensitive.
</Tip>

<AccordionGroup>
  <Accordion title="All fields" icon="list">
    **Required:**

    <CostsRequiredFields />

    <CostsOptionalFields />
  </Accordion>

  <Accordion title="Example file" icon="file-csv">
    ```csv theme={null}
    date,channel,channelGroup,campaign,cost,country,currency,campaignId
    2024-01-15,facebook,social_ppc,Summer Sale 2024,1250.75,US,USD,camp_001
    2024-01-15,instagram,social_ppc,Summer Sale 2024,875.50,US,USD,camp_002
    2024-01-16,google,sem,Winter Collection,2100.25,GB,GBP,camp_003
    2024-01-17,newsletter,email,New Arrivals,350.00,DE,EUR,camp_004
    ```
  </Accordion>
</AccordionGroup>

## Available values

### Channel groups & channels

<Info>
  All channel and channel group values are case-insensitive. You can use any combination of uppercase and lowercase letters.
</Info>

Each accordion below represents a **channel group** (with its code in parentheses). The values listed are the **available channels** for that group.

<AccordionGroup>
  <Accordion title="Affiliate (affiliate)" icon="handshake">
    |                         |                      |                     |
    | ----------------------- | -------------------- | ------------------- |
    | `actionpay`             | `adtraction`         | `adviralmedia`      |
    | `awin`                  | `awin/zanox`         | `belboon`           |
    | `benify`                | `beste.no`           | `bezrak.com`        |
    | `billigt_kosttillskott` | `bnpl`               | `cashbackPartner`   |
    | `cj`                    | `contentPartner`     | `cuponation`        |
    | `discountCodePartner`   | `double.net`         | `editorialPartner`  |
    | `epassi`                | `frank`              | `good_on_you`       |
    | `gowish`                | `healthtrader`       | `impact`            |
    | `influencer`            | `influencerNetwork`  | `klarna`            |
    | `linkby`                | `linkshare/rakuten`  | `loyaltyPartner`    |
    | `maxbounty`             | `mecenat`            | `mecenat_alumni`    |
    | `medicaltime.bg`        | `metapic`            | `others`            |
    | `partner-ads`           | `playsit`            | `recensionsplatsen` |
    | `re:member_reward`      | `sas_onlineshopping` | `sponsorhuset`      |
    | `stepler`               | `studentkortet`      | `styrkelabbet`      |
    | `subNetwork`            | `tracdelight`        | `tradedoubler`      |
    | `tradetracker`          | `trumf.no`           | `webgains`          |
    | `wordseed`              | `wrapp`              | `zdrave.net`        |
  </Accordion>

  <Accordion title="AI Organic (ai_organic)" icon="robot">
    |              |           |           |
    | ------------ | --------- | --------- |
    | `chatgpt`    | `claude`  | `copilot` |
    | `deepseek`   | `gemini`  | `grok`    |
    | `meta_ai`    | `mistral` | `others`  |
    | `perplexity` | `phind`   | `poe`     |
    | `you_com`    |           |           |
  </Accordion>

  <Accordion title="AI Paid (ai_paid)" icon="robot">
    |              |           |           |
    | ------------ | --------- | --------- |
    | `chatgpt`    | `claude`  | `copilot` |
    | `deepseek`   | `gemini`  | `grok`    |
    | `meta_ai`    | `mistral` | `others`  |
    | `perplexity` | `phind`   | `poe`     |
    | `you_com`    |           |           |
  </Accordion>

  <Accordion title="Backfilled orders (backfilled)" icon="clock-rotate-left">
    |                     |   |   |
    | ------------------- | - | - |
    | `backfilled_orders` |   |   |
  </Accordion>

  <Accordion title="Branding (branding)" icon="bullhorn">
    |                 |            |                    |
    | --------------- | ---------- | ------------------ |
    | `content`       | `event`    | `flyers`           |
    | `gift_in_order` | `giveaway` | `im_macro`         |
    | `im_mini`       | `im_nano`  | `media_production` |
    | `pr`            | `store`    |                    |
  </Accordion>

  <Accordion title="CRM (email)" icon="envelope">
    |                 |                    |                       |
    | --------------- | ------------------ | --------------------- |
    | `automation`    | `bounty`           | `cart_abandonment`    |
    | `clienteling`   | `customer_service` | `engaged_subscribers` |
    | `external`      | `leaflet`          | `loyalty_program`     |
    | `newsletter`    | `onboarding`       | `osm`                 |
    | `others`        | `post_purchase`    | `reminder`            |
    | `restock_alert` | `sample`           | `sms`                 |
    | `transaction`   |                    |                       |
  </Accordion>

  <Accordion title="Direct (direct)" icon="arrow-pointer">
    |          |   |   |
    | -------- | - | - |
    | `direct` |   |   |
  </Accordion>

  <Accordion title="Display (display)" icon="rectangle-ad">
    |              |              |                       |
    | ------------ | ------------ | --------------------- |
    | `adform`     | `bonnier`    | `clearchanneloutdoor` |
    | `criteo`     | `delta`      | `google`              |
    | `loopi`      | `mntn`       | `nyheter24`           |
    | `others`     | `rakuten`    | `rocketfuel`          |
    | `schibstedt` | `stackadapt` | `ve_interactive`      |
  </Accordion>

  <Accordion title="Influencers (influencers)" icon="user-group">
    |                   |                          |                |
    | ----------------- | ------------------------ | -------------- |
    | `apprl`           | `athletes`               | `beatly`       |
    | `contentCreators` | `externalCollaborations` | `independent`  |
    | `inzpire`         | `metapic`                | `pressRelease` |
    | `reech`           | `seeding`                |                |
  </Accordion>

  <Accordion title="Marketplace (marketplace)" icon="store">
    |          |            |   |
    | -------- | ---------- | - |
    | `miinto` | `shop_app` |   |
  </Accordion>

  <Accordion title="Marketing (marketing)" icon="chart-line">
    |                  |   |   |
    | ---------------- | - | - |
    | `tools_external` |   |   |
  </Accordion>

  <Accordion title="Offline (offline)" icon="newspaper">
    |         |             |                |
    | ------- | ----------- | -------------- |
    | `event` | `fairs`     | `leaflet`      |
    | `ooh`   | `others`    | `partnerships` |
    | `print` | `wholesale` |                |
  </Accordion>

  <Accordion title="Onsite (onsite)" icon="browser">
    |                  |          |               |
    | ---------------- | -------- | ------------- |
    | `exit_intent`    | `others` | `push_notice` |
    | `ve_interactive` |          |               |
  </Accordion>

  <Accordion title="Price comparison (price_comparison)" icon="magnifying-glass-dollar">
    |            |              |                |
    | ---------- | ------------ | -------------- |
    | `google`   | `hintaopas`  | `idealo`       |
    | `kelkoo`   | `others`     | `price_runner` |
    | `pricepi`  | `pricespy`   | `prisguiden`   |
    | `prisjakt` | `prisvis`    | `shopalike`    |
    | `shopello` | `spotashop`  | `stileo`       |
    | `twenga`   | `varusok.se` | `vertaa`       |
  </Accordion>

  <Accordion title="Referral (referral)" icon="share-from-square">
    |             |                 |              |
    | ----------- | --------------- | ------------ |
    | `article`   | `blog`          | `blocket`    |
    | `bounty`    | `capterra`      | `clearpay`   |
    | `flashback` | `forum`         | `frank`      |
    | `google`    | `idealo`        | `mecenat`    |
    | `naver`     | `nettavisen`    | `onskeskyen` |
    | `others`    | `podcast`       | `pr`         |
    | `reddit`    | `redeal`        | `shopello`   |
    | `stepler`   | `studentkortet` | `trustpilot` |
    | `twenga`    | `vg`            |              |
  </Accordion>

  <Accordion title="Retargeting (retargeting)" icon="bullseye">
    |            |               |                  |
    | ---------- | ------------- | ---------------- |
    | `adroll`   | `criteo`      | `facebook`       |
    | `google`   | `mythings`    | `nosto`          |
    | `others`   | `rakuten`     | `rocketfuel`     |
    | `rtbhouse` | `sociomantic` | `ve_interactive` |
  </Accordion>

  <Accordion title="Search organic (organic)" icon="magnifying-glass">
    |          |              |          |
    | -------- | ------------ | -------- |
    | `bing`   | `duckduckgo` | `google` |
    | `others` | `yahoo`      | `yandex` |
  </Accordion>

  <Accordion title="Search paid (sem)" icon="rectangle-ad">
    |               |         |          |
    | ------------- | ------- | -------- |
    | `agency`      | `baidu` | `bing`   |
    | `google`      | `naver` | `others` |
    | `shoptimised` | `yahoo` | `yandex` |
    | `youtube`     |         |          |
  </Accordion>

  <Accordion title="Social organic (social_organic)" icon="thumbs-up">
    |            |             |             |
    | ---------- | ----------- | ----------- |
    | `facebook` | `google`    | `instagram` |
    | `kakao`    | `line`      | `linkedin`  |
    | `others`   | `pinterest` | `snapchat`  |
    | `tiktok`   | `twitter`   | `vkontakte` |
    | `wechat`   | `youtube`   |             |
  </Accordion>

  <Accordion title="Social paid (social_ppc)" icon="money-bill">
    |             |          |               |
    | ----------- | -------- | ------------- |
    | `facebook`  | `google` | `influencers` |
    | `instagram` | `kakao`  | `line`        |
    | `linkedin`  | `others` | `pinterest`   |
    | `quora`     | `reddit` | `snapchat`    |
    | `threads`   | `tiktok` | `twitter`     |
    | `vkontakte` | `wechat` | `youtube`     |
  </Accordion>

  <Accordion title="Unknown (unknown)" icon="question">
    |         |           |   |
    | ------- | --------- | - |
    | `dummy` | `unknown` |   |
  </Accordion>

  <Accordion title="Whitelisting (whitelisting)" icon="user-check">
    |             |            |               |
    | ----------- | ---------- | ------------- |
    | `facebook`  | `google`   | `influencers` |
    | `instagram` | `linkedin` | `others`      |
    | `pinterest` | `quora`    | `snapchat`    |
    | `tiktok`    | `twitter`  | `vkontakte`   |
    | `youtube`   |            |               |
  </Accordion>
</AccordionGroup>

## Processing

<CardGroup cols={2}>
  <Card title="Initial import" icon="download">
    On the first fetch, we import data going back **two years**
  </Card>

  <Card title="Ongoing updates" icon="rotate">
    Subsequent updates fetch data from the **last 30 days** only. Older data will not be updated.
  </Card>
</CardGroup>

## Limitations

<Warning>
  Please ensure your Google Sheet meets these requirements:

  * Data must reside in the **first sheet tab**
  * Headers must be in the **first row**
  * Only columns **A-AZ** are read
</Warning>

## Troubleshooting and support

If you encounter any issues during the integration process or have questions regarding data processing, please contact our support team for assistance.

## Additional resources

For further information on managing your Google Sheets and understanding data formats, visit the [Google Sheets Help Center](https://support.google.com/sheets).
