Example configurations

Prev

Here we have collected example connector configurations that you can use as reference, or take and modify for your own usage.

Awin

Description

A connector to fetch Transaction data for advertiser accounts from Awin.

API used

Awin v1 API

Get Accounts endpoint to fetch a list of Advertiser accounts

Get List of Transactions -endpoint to fetch transaction data

Authentication method

API key

Account fetcher

Yes.

  • Fetches a list of Advertiser accounts the API has access to.

  • Filters accounts based on user role.

Report types

Has one report type to fetch transactions:

  • Request:

    • GET request to Awin API

    • Uses customer’s access token via placeholders in headers of the data fetching request

    • Uses query date range values dynamically via placeholders as parameters in data fetching request

  • Response:

    • Reads returned data from JSON formatted response

  • Fields:

    • Has a wide variety of dimensions and metrics available

    • Uses “convert_date” operation to convert date to a correct format

Open to see Awin example configuration

{
  "$schema": "https://api.supermetrics.com/cc/v1/schema/connector",
  "authentication": {
    "type": "user_input",
    "description": "Please insert your Awin API token and give a name for your login. \n\n <a href=\"https://support.supermetrics.com/support/solutions/articles/19000131434-awin-authentication-and-reauthentication-guide\" target=\"_blank\">Need help connecting?</a>",
    "userInputs": [
      {
        "id": "api_key",
        "label": "API token",
        "type": "password"
      },
      {
        "id": "account_name",
        "label": "Give a name for your login",
        "type": "text"
      }
    ]
  },
  "dataSourceUser": {
    "userInfo": {
      "id": {
        "source": "static",
        "value": "{{ identity() }}"
      },
      "label": {
        "source": "userInput",
        "value": "account_name"
      },
      "accessToken": {
        "source": "userInput",
        "value": "api_key"
      }
    }
  },
  "accounts": {
    "fetchers": [
      {
        "request": {
          "url": "https://api.awin.com/accounts",
          "parameters": [
            {
              "name": "type",
              "value": "advertiser"
            }
          ],
          "headers": [
            {
              "name": "Authorization",
              "value": "Bearer {{user.access_token}}"
            }
          ],
          "response": {
            "dataRows": {
              "source": "jsonPath",
              "value": "$.accounts.*"
            }
          }
        },
        "accountInfo": {
          "id": {
            "source": "jsonPath",
            "value": "$.accountId"
          },
          "label": {
            "source": "jsonPath",
            "value": "$.accountName"
          },
          "group": {
            "source": "static",
            "value": "Advertisers"
          },
          "properties": [
            {
              "id": "accountType",
              "source": "jsonPath",
              "value": "$.accountType"
            },
            {
              "id": "userRole",
              "source": "jsonPath",
              "value": "$.userRole"
            }
          ]
        }
      }
    ],
    "filter": [
      {
        "value": {
          "source": "jsonPath",
          "value": "$.userRole"
        },
        "not": {
          "equals": "userServicedUser"
        }
      }
    ]
  },
  "reporting": {
    "reportTypes": [
      {
        "id": "trans",
        "title": "Transactions report",
        "config": {
          "showDefaultDateFields": true,
          "readDateFrom": "transaction_date_time",
          "splitRequestsToMonths": true
        },
        "request": {
          "headers": [
            {
              "name": "Authorization",
              "value": "Bearer {{user.access_token}}"
            }
          ],
          "url": "https://api.awin.com/advertisers/{{account.id}}/transactions/",
          "parameters": [
            {
              "name": "startDate",
              "value": "{{query.startDate.atom}}"
            },
            {
              "name": "endDate",
              "value": "{{query.endDate.atom}}"
            }
          ],
          "response": {
            "dataRows": {
              "source": "jsonPath",
              "value": "$.*"
            }
          }
        },
        "dimensions": {
          "groups": [
            {
              "label": "Transaction",
              "fields": [
                {
                  "id": "campaign",
                  "label": "Campaign name",
                  "description": "Name of the campaign",
                  "dataType": "string.text.value",
                  "value": {
                    "source": "jsonPath",
                    "value": "$.campaign"
                  }
                },
                {
                  "id": "transaction_id",
                  "label": "Transaction ID",
                  "description": "ID of the transaction",
                  "dataType": "string.text.value",
                  "value": {
                    "source": "jsonPath",
                    "value": "$.id"
                  }
                },
                {
                  "id": "transaction_query_id",
                  "label": "Transaction query ID",
                  "description": "The unique ID of the transaction query",
                  "dataType": "string.text.value",
                  "value": {
                    "source": "jsonPath",
                    "value": "$.transactionQueryId"
                  }
                },
                {
                  "id": "type",
                  "label": "Transaction type",
                  "description": "The type of the transaction",
                  "dataType": "string.text.value",
                  "value": {
                    "source": "jsonPath",
                    "value": "$.type"
                  }
                },
                {
                  "id": "transaction_url",
                  "label": "Transaction URL",
                  "description": "URL of the transaction",
                  "dataType": "string.text.url",
                  "value": {
                    "source": "jsonPath",
                    "value": "$.url"
                  }
                },
                {
                  "id": "transaction_date",
                  "label": "Transaction date",
                  "description": "The date and time of the click",
                  "dataType": "string.time.date",
                  "subfields": [
                    "transaction_date_time"
                  ],
                  "dimensionValueFormat": {
                    "operation": "convert_date",
                    "parameters": [
                      "",
                      "Y-m-d"
                    ]
                  }
                },
                {
                  "id": "transaction_date_time",
                  "label": "Transaction date and time",
                  "description": "The date and time of the transaction",
                  "dataType": "string.time.datetime",
                  "value": {
                    "source": "jsonPath",
                    "value": "$.transactionDate"
                  }
                },
                {
                  "id": "decline_reason",
                  "label": "Transaction decline reason",
                  "description": "The decline reason of the transaction",
                  "dataType": "string.text.value",
                  "value": {
                    "source": "jsonPath",
                    "value": "$.declineReason"
                  }
                },
                {
                  "id": "transaction_device",
                  "label": "Transaction device",
                  "description": "Device where transaction happened",
                  "dataType": "string.text.value",
                  "value": {
                    "source": "jsonPath",
                    "value": "$.transactionDevice"
                  }
                },
                {
                  "id": "voucher_code_used",
                  "label": "Voucher code used",
                  "description": "Whether voucher code was used or not for transaction",
                  "dataType": "bool",
                  "value": {
                    "source": "jsonPath",
                    "value": "$.voucherCodeUsed"
                  }
                },
                {
                  "id": "voucher_code",
                  "label": "Voucher code",
                  "description": "The voucher code that was used for the transaction",
                  "dataType": "string.text.value",
                  "value": {
                    "source": "jsonPath",
                    "value": "$.voucherCode"
                  }
                },
                {
                  "id": "amended",
                  "label": "Amended",
                  "description": "Whether transaction has been amended or not",
                  "dataType": "bool",
                  "value": {
                    "source": "jsonPath",
                    "value": "$.amended"
                  }
                },
                {
                  "id": "amend_reason",
                  "label": "Amend reason",
                  "description": "Reason why transaction was amended",
                  "dataType": "string.text.value",
                  "value": {
                    "source": "jsonPath",
                    "value": "$.amendReason"
                  }
                },
                {
                  "id": "commission_group_code",
                  "label": "Commission group code",
                  "description": "Commission group code of the transaction parts",
                  "dataType": "string.text.value",
                  "value": {
                    "source": "jsonPath",
                    "value": "$.transactionParts[*].commissionGroupCode"
                  },
                  "isVisible": false
                },
                {
                  "id": "transaction_parts",
                  "label": "Transaction parts",
                  "description": "Transaction parts",
                  "dataType": "string.text.value",
                  "subfields": [
                    "commission_group_code",
                    "transaction_parts_amount"
                  ],
                  "calculation": [
                    {
                      "operation": "concat",
                      "parameters": [
                        ":"
                      ]
                    }
                  ]
                },
                {
                  "id": "custom_parameters",
                  "label": "Custom parameters",
                  "description": "List of custom parameters and values",
                  "dataType": "string.text.value",
                  "value": {
                    "source": "jsonPath",
                    "value": "$.customParameters"
                  }
                }
              ]
            },
            {
              "label": "Advertiser",
              "fields": [
                {
                  "id": "advertiser_id",
                  "label": "Advertiser ID",
                  "description": "ID of the advertiser",
                  "dataType": "string.text.value",
                  "value": {
                    "source": "jsonPath",
                    "value": "$.advertiserId"
                  }
                },
                {
                  "id": "advertiser_country",
                  "label": "Advertiser country",
                  "description": "The country of the advertiser",
                  "dataType": "string.geo.country.twolettercode",
                  "value": {
                    "source": "jsonPath",
                    "value": "$.advertiserCountry"
                  }
                }
              ]
            },
            {
              "label": "Publisher",
              "fields": [
                {
                  "id": "publisher_id",
                  "label": "Publisher ID",
                  "description": "ID of the publisher",
                  "dataType": "string.text.value",
                  "value": {
                    "source": "jsonPath",
                    "value": "$.publisherId"
                  }
                },
                {
                  "id": "site_name",
                  "label": "Site name",
                  "description": "Name of the site",
                  "dataType": "string.text.value",
                  "value": {
                    "source": "jsonPath",
                    "value": "$.siteName"
                  }
                },
                {
                  "id": "publisher_url",
                  "label": "Publisher URL",
                  "description": "The URL of the publisher",
                  "dataType": "string.text.url",
                  "value": {
                    "source": "jsonPath",
                    "value": "$.publisherUrl"
                  }
                },
                {
                  "id": "commission_sharing_publisher_id",
                  "label": "Commission sharing publisher ID",
                  "description": "ID of the commission sharing publisher",
                  "dataType": "string.text.value",
                  "value": {
                    "source": "jsonPath",
                    "value": "$.commissionSharingPublisherId"
                  }
                },
                {
                  "id": "commission_sharing_selected_rate_publisher_id",
                  "label": "Commission sharing selected rate publisher ID",
                  "description": "ID of the commission sharing selected rate publisher",
                  "dataType": "string.text.value",
                  "value": {
                    "source": "jsonPath",
                    "value": "$.commissionSharingSelectedRatePublisherId"
                  }
                }
              ]
            },
            {
              "label": "Customer",
              "fields": [
                {
                  "id": "customer_country",
                  "label": "Customer country",
                  "description": "Country of the customer",
                  "dataType": "string.text.value",
                  "value": {
                    "source": "jsonPath",
                    "value": "$.customerCountry"
                  }
                },
                {
                  "id": "ip_hash",
                  "label": "IP hash",
                  "description": "Hash of the IP address",
                  "dataType": "string.text.value",
                  "value": {
                    "source": "jsonPath",
                    "value": "$.ipHash"
                  }
                }
              ]
            },
            {
              "label": "Click",
              "fields": [
                {
                  "id": "click_ref",
                  "label": "Click reference",
                  "description": "Click reference for transaction",
                  "dataType": "string.text.value",
                  "value": {
                    "source": "jsonPath",
                    "value": "$.clickRefs.clickRef"
                  }
                },
                {
                  "id": "click_date",
                  "label": "Click date",
                  "description": "The date of the click",
                  "dataType": "string.time.date",
                  "subfields": [
                    "click_date_time"
                  ],
                  "dimensionValueFormat": {
                    "operation": "convert_date",
                    "parameters": [
                      "",
                      "Y-m-d"
                    ]
                  }
                },
                {
                  "id": "click_date_time",
                  "label": "Click date and time",
                  "description": "The date and time of the click",
                  "dataType": "string.time.datetime",
                  "value": {
                    "source": "jsonPath",
                    "value": "$.clickDate"
                  }
                },
                {
                  "id": "click_device",
                  "label": "Click device",
                  "description": "Device where click happened",
                  "dataType": "string.text.value",
                  "value": {
                    "source": "jsonPath",
                    "value": "$.clickDevice"
                  }
                }
              ]
            },
            {
              "label": "Commission",
              "fields": [
                {
                  "id": "order_ref",
                  "label": "Order reference",
                  "description": "The reference of the order",
                  "dataType": "string.text.value",
                  "value": {
                    "source": "jsonPath",
                    "value": "$.orderRef"
                  }
                },
                {
                  "id": "sale_currency",
                  "label": "Sale currency",
                  "description": "Currency of the sale",
                  "dataType": "string.text.value",
                  "value": {
                    "source": "jsonPath",
                    "value": "$.saleAmount.currency"
                  }
                },
                {
                  "id": "commission_currency",
                  "label": "Commission currency",
                  "description": "Currency of the commission",
                  "dataType": "string.text.value",
                  "value": {
                    "source": "jsonPath",
                    "value": "$.commissionAmount.currency"
                  }
                },
                {
                  "id": "commission_status",
                  "label": "Commission status",
                  "description": "Status of the commission",
                  "dataType": "string.text.value",
                  "value": {
                    "source": "jsonPath",
                    "value": "$.commissionStatus"
                  }
                },
                {
                  "id": "paid_to_publisher",
                  "label": "Paid to publisher",
                  "description": "Whether transaction commission has been paid to publisher or not",
                  "dataType": "bool",
                  "value": {
                    "source": "jsonPath",
                    "value": "$.paidToPublisher"
                  }
                },
                {
                  "id": "payment_id",
                  "label": "Payment ID",
                  "description": "The unique ID of the payment",
                  "dataType": "string.text.value",
                  "value": {
                    "source": "jsonPath",
                    "value": "$.paymentId"
                  }
                }
              ]
            }
          ]
        },
        "metrics": {
          "groups": [
            {
              "label": "Transaction",
              "fields": [
                {
                  "id": "commission_amount",
                  "label": "Commission amount",
                  "description": "The amount of commission",
                  "dataType": "float.currency.value",
                  "value": {
                    "source": "jsonPath",
                    "value": "$.commissionAmount.amount"
                  }
                },
                {
                  "id": "sale_amount",
                  "label": "Sale amount",
                  "description": "The amount of sale",
                  "dataType": "float.currency.value",
                  "value": {
                    "source": "jsonPath",
                    "value": "$.saleAmount.amount"
                  }
                },
                {
                  "id": "old_sale_amount",
                  "label": "Old sale amount",
                  "dataType": "float.currency.value",
                  "value": {
                    "source": "jsonPath",
                    "value": "$.oldSaleAmount.amount"
                  }
                },
                {
                  "id": "old_commission_amount",
                  "label": "Old commission amount",
                  "dataType": "float.currency.value",
                  "value": {
                    "source": "jsonPath",
                    "value": "$.oldCommissionAmount.amount"
                  }
                },
                {
                  "id": "original_sale_amount",
                  "label": "Original sale amount",
                  "description": "The original sale amount",
                  "dataType": "float.currency.value",
                  "value": {
                    "source": "jsonPath",
                    "value": "$.originalSaleAmount"
                  }
                },
                {
                  "id": "lapse_time",
                  "label": "Lapse time",
                  "description": "The conversion time in seconds",
                  "dataType": "int.number.value",
                  "value": {
                    "source": "jsonPath",
                    "value": "$.lapseTime"
                  }
                },
                {
                  "id": "network_fee",
                  "label": "Network fee",
                  "description": "Network fee of the transactions",
                  "dataType": "float.currency.value",
                  "value": {
                    "source": "jsonPath",
                    "value": "$.networkFee.amount"
                  }
                },
                {
                  "id": "transaction_parts_amount",
                  "label": "Transaction parts amount",
                  "description": "Amount of the transaction parts",
                  "dataType": "float.currency.value",
                  "value": {
                    "source": "jsonPath",
                    "value": "$.transactionParts[*].amount"
                  },
                  "isVisible": false
                }
              ]
            }
          ]
        }
      }
    ]
  },
  "defaultResponseHandler": {
    "responseStatuses": [
      {
        "httpStatus": 200,
        "action": "success"
      },
      {
        "httpStatus": 400,
        "action": "error",
        "message": "Error",
        "messageDetails": {
          "source": "jsonPath",
          "value": "$.description"
        }
      },
      {
        "httpStatus": 401,
        "action": "error",
        "message": "Error",
        "messageDetails": {
          "source": "jsonPath",
          "value": "$.description"
        }
      },
      {
        "httpStatus": 429,
        "action": "retry",
        "messageDetails": {
          "source": "static",
          "value": "API rate limit exceeded. If this problem appears again, please reach out to Awin to increase your API rate limits. Read more here: https://support.supermetrics.com/support/solutions/articles/19000137094-about-api-rate-limits-in-awin"
        }
      }
    ],
    "conditionalStatuses": [
      {
        "conditions": [
          {
            "value": {
              "source": "jsonPath",
              "value": "$.error"
            },
            "is": {
              "contains": "access_denied"
            }
          },
          {
            "value": {
              "source": "jsonPath",
              "value": "$.description"
            },
            "is": {
              "contains": "Access is denied"
            }
          },
          {
            "value": {
              "source": "responseStatus",
              "value": ""
            },
            "is": {
              "equals": "403"
            }
          }
        ],
        "type": "and",
        "action": "exclude_invalid_account_data"
      },
      {
        "conditions": [
          {
            "value": {
              "source": "responseStatus",
              "value": ""
            },
            "is": {
              "equals": "403"
            }
          }
        ],
        "action": "error",
        "message": "Forbidden",
        "messageDetails": {
          "source": "static",
          "value": "“Access is denied. Please make sure you are using a valid API key related to an advertiser account. Publisher or any other type of accounts are not currently supported."
        }
      }
    ],
    "retry": {
      "maxRetries": 20,
      "minWait": 2,
      "maxWait": 60,
      "delayType": "exp"
    }
  }
}