Campaign and Lead Source Report API
Overview
Use the Campaign and Lead Source Report API to get real-time reports on performance by Lead Source and Campaign. The API returns data on number of leads, scoring averages, and performance by lead source or campaign. Using Google Sheets or Excel, you can easily link this API into local reports.
Endpoint (6.3)
https://feed-api.ehawk.net/report/
The API accepts both HTTPS POST and HTTPS GET.
For GET use the format:
https://feed-api.ehawk.net/report/function/?keyword=value
When using POST, make sure to have Content-Type: application/x-www-form-urlencoded
CURL POST API call example:
curl -X POST -H Content-Type:application/x-www-form-urlencoded -d 'apikey=your_apikey' https://feed-api.ehawk.net/report/function/
Functions
Select the action to take using function values:
leadsource
Returns data on lead source performance. For example:
https://feed-api.ehawk.net/report/leadsource?apikey=your_apikey
campaign
Returns data on campaign performance. For example:
https://feed-api.ehawk.net/report/campaign?apikey=your_apikey
Keywords
Every API call requires the apikey and you can add keyword and values to customize your report.
Keyword | Value and Format |
---|---|
apikey | Your E-HAWK Vetting API KEY (required) |
period | Number of days to include in the report. Value can be 1 to 35. Default is 5. Set to 15 for the last fifteen days. For current day, use 1. |
min_leads | Minimum leads for the source or campaign within the period. Default 100. To filter for campaigns with 10 or more leads, set to 10. |
search | Search by Lead Source or Campaign Name. Format is search=value. Search is value + wildcard. |
threshold | Threshold score setting. Default is very_high (a risk score of -71 to -100). Options are: low some medium high very_high for scoring bands see, How is the risk score calculated? |
orderBy | Sort options: (default is threshold) threshold largest percent over threshold threshold_count number of leads over threshold count Count of leads avg Average score of leads name Source or Campaign Name, A to Z name_desc Source or Campaign Name, Z to A |
As an example, calling the API POST for a campaign report of the last 10 days and minimum lead count of 10 with CURL:
curl -X POST -H Content-Type:application/x-www-form-urlencoded -d 'apikey=your_apikey&period=10&min_leads=10' https://feed-api.ehawk.net/report/campaign/
And with GET:
https://feed-api.ehawk.net/report/campaign?apikey=your_apikey&period=10&min_leads=10
JSON Response
The report is returned as a JSON with a maximum of 500 items/rows in the format:
{ "response": [ { "name": "Campaign or Lead Source Name/Value", "sub_id": "Lead Source Sub ID", "count": 22, "threshold_count": 20, "threshold": "91%", "avg": -92 } ], "status": 200 }
Status Codes
Status | Response |
---|---|
200 | OK (no errors) |
-6 | IP not in ACL |
502 | Invalid APIKEY or URL |
Excel, gSheets Integration
You can integrate this report into a Google Sheet for real-time reporting. Just follow the instructions at https://github.com/bradjasper/ImportJSON. Create a Google Sheet, then add the script to the Script Editor. In the top cell enter the URL and keywords. For example, to get a campaign report:=ImportJSON("https://feed-api.ehawk.net/report/campaign?apikey=your_apikey", "/response")
When the gSheet opens the report data will refresh.
You can also use Excel on Windows to build the same real-time reporting using Power Query.