# Contact Logs

## Contact logs

The Contact logs resource stores logging information about a Form builder form submission lead by a visitor to a Site.

## Contact log Model

### Contact log object

A contact log object contains the following fields

| Attribute        | Type     | Description                                                                                         |
| ---------------- | -------- | --------------------------------------------------------------------------------------------------- |
| id               | integer  | unique id of the log                                                                                |
| site\_id         | integer  | Reference id to the Site the lead was associated with                                               |
| form\_id         | integer  | Reference id to the Form builder form that the lead was associated with                             |
| location\_id     | integer  | Reference id to the Location the lead was associated with                                           |
| note             | string   | If the lead was identified as spam (spam=true), then reason is described here.                      |
| timestamp        | datetime | Date and time that the lead was generated                                                           |
| spam             | boolean  | Was the lead identified as spam by filters.                                                         |
| stage            | string   | Stage set on the lead. Examples: `partial`, `new`, `spam`, `suppressed`, `logged`                   |
| data             | object   | Contains the fields and values of the form lead                                                     |
| email            | string   | Parsed email address from lead, if applicable                                                       |
| phone            | string   | Parsed phone number from lead, if applicable                                                        |
| recipients       | list     | List of intended or delivered recipients (email addresses) for the lead                             |
| campaign\_params | object   | Session analytics attributes. These include thing like UTM parameters and other tracked attributes. |
| dispatched       | boolean  | Was the lead dispatched (emailed, CRM, webhooks)                                                    |
| dispatch\_date   | datetime | Date and time that the lead was dispatched                                                          |
| logs             | list     | List of logs related to filters and dispatchers that ran based on the Form configuration            |

#### Example object

```json
{
  "campaign_params": {
    "utm_campaign": "ppc campaign",
    "utm_source": "google",
    ...
  },
  "data": {
    "email-addresss": "example@example.com",
    "your-name": "John Doe",
    "phone": "206-555-5555",
    "subscribe": true
  },
  "dispatched": true,
  "dispatch_date": "2012-06-01T09:28:46",
  "email": "example@example.com",
  "form_id": 12345,
  "id": 328269,
  "ip": "187.232.189.217",
  "location_id": 12345,
  "logs": [
    {
      "filter": "Filter name",
    },
    ...
  ],
  "note": "Flagged as spam by Akismet",
  "phone": "206-555-5555",
  "recipients": ["owner@site.com", "leads@site.com"],
  "resource_uri": "/api/v2/contact_log/328269/",
  "site_id": 12345,
  "spam": true,
  "stage": "new",
  "timestamp": "2012-06-01T09:28:46",
  ...
}
```

*Note: there are a number of columns not listed above that are present in the API response. It is not guaranteed that all leads contain these fields, so integrations should not be developed that depend on them.*

### Campaign params (`campaign_params`)&#x20;

If available, these are the analytics/attribution details tied to the Contact log. Below are descriptions of their meaning.

* UTM prefixed parameters
  * `utm_source`
  * `utm_campaign`
  * `utm_keyword`
  * `utm_medium`
  * `utm_term`
  * And any other parameter prefixed by (`utm_`)
* Marketing parameter Click IDs - (i.e. gclid)
  * `dclid` (doubleclick)
  * `fbclid` (facebook)
  * `gbraid` (google)
  * `gclid` (google)
  * `gclsrc` (google)
  * `li_fat_id` (linkedin)
  * `msclkid` (microsoft/bing)
  * `ttclid` (tiktok)
  * `twclid` (twitter)
  * `wbraid` (google)
  * `yclid` (yahoo and yandex)
* Other session data
  * `$search_engine` - Which search engine did they come from
  * `initial_landing_page` - This is the full URL of the initial page the visitor landed on in thier session
  * `$initial_referring_domain` - Referring domain
  * `$initial_referrer` - Referring URL
  * `distinct_id` - Unique ID for the session
  * `site-session-page-views` - Total page views within the session
  * `$device_id` - ID of the device used in the session
* DevHub metadata (Site, Page, etc)
  * Domain fields
    * `domain`
    * `subdomain`
    * `formatted_domain`
  * `page_name` - Page name
  * `page_title` - Page title tag
  * `site_id` - DevHub site\_id where the session happened
  * `theme_id` - DevHub theme/template ID

All double underscore-prefixed variables can be ignored (`__mpus`, `__mpso`, `__mpr`, `__mpu`, `__mps`). These are internal data used by one of our analytics sources Mixpanel.com

## List contact logs

List all contact logs within the instance

```
GET /api/v2/contact_log/
```

List all contact form logs for a site

```
GET /api/v2/contact_log/?site_id=12345
```

### Parameters

| Name       | Type     | Description                                                                                                                                                                    |
| ---------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `site_id`  | `string` | ID of the `Site` you want to get the logs for                                                                                                                                  |
| `order_by` | `string` | Set the field to sort the results by. Available `order_by` includes `id` (default). You can also sort decending by prefixing the field with a minus sign (i.e. `order_by=-id`) |
| `id__gt`   | `string` | Filter the list to only the contact logs greater than a certain contact log ID                                                                                                 |

### Response

```json
{
  "meta": {
    "limit": 20,
    "next": "/api/v2/contact_log/?limit=20&offset=20",
    "offset": 0,
    "previous": null,
    "total_count": 5
  },
  "objects": [
    {
      "email": "example@example.com",
      "form_id": 12345,
      "id": 328269,
      "ip": "187.232.189.217",
      "name": "John Doe",
      "note": "Flagged as spam by Akismet",
      "phone": "206-555-5555",
      "resource_uri": "/api/v2/contact_log/328269/",
      "site_id": 12345,
      "spam": true,
      "timestamp": "2012-06-01T09:28:46"
      ...
    },
    ...
  ]
}
```
