# Introduction

This section provides an overview for the Shop Locator API.

Table of Contents:

# Recorded Metrics

The Shop Locator logs Actions and Labels.

# Actions

An action is a verb and describes something that happened on the Shop Locator due to some initial action or input provided by the application user.

field Description
SearchResults The shop appeared in the search results.
ShopViewed The shop was viewed by clicking/tapping the shop name in the sidebar or clicking/tapping the shop's marker on the map.
WebsiteClicked The website was clicked/tapped in the sidebar or via the shop's marker on the map.
PhoneClicked The phone number was was clicked/tapped in the sidebar or via the shop's marker on the map.
RequestEstimate The request estimate was was clicked/tapped in the sidebar or via the shop's marker on the map.

# Labels

The label describes where the action took place.

field Description
Sidebar The left-most content area displaying a list of shops after a search has been performed.
Map The map section displaying a list of shop pins after a search has been performed.
Appeared The shop appeared on the map.
curl --location --request POST '{url}/api/analytics/{apnId}' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {access_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "start_date": "2020-07-05",
    "end_date": "2020-08-06",
}'

Example Response

{
    "data": [
        {
            "network": "infiniti",
            "apn_id": "264254",
            "action": "SearchResults",
            "label": "Appeared",
            "count": 59
        },
        {
            "network": "infiniti",
            "apn_id": "264254",
            "action": "ShopViewed",
            "label": "Map",
            "count": 10
        },
        {
            "network": "infiniti",
            "apn_id": "264254",
            "action": "ShopViewed",
            "label": "Sidebar",
            "count": 1
        },
        {
            "network": "nissan",
            "apn_id": "264254",
            "action": "SearchResults",
            "label": "Appeared",
            "count": 34
        },
        {
            "network": "nissan",
            "apn_id": "264254",
            "action": "SearchResults",
            "label": "Map",
            "count": 1
        },
        {
            "network": "nissan",
            "apn_id": "264254",
            "action": "ShopViewed",
            "label": "Map",
            "count": 8
        }
    ]
}

# Fetch Action Summary

HTTP POST /analytics/{apnId}

Fetch a summary of all analytics actions.

URL Requirements

{apnId} - A valid APN ID

# Request Parameters

Name Type Description Required
start_date Date An ISO 8601 date ie 2019-01-01 No
end_date Date An ISO 8601 date ie 2020-01-01 No
network Enum null(all) | nissan | gtr | infiniti No

# Response

field Description
network The network this record pertains to
apn_id The APN Id
action The action taken
label The action's location
count The number of times this action was found for this Network, APN ID, and Label
curl --location --request POST '{url}/api/analytics/{apnId}/actions' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {access_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "start_date": "2020-08-05",
    "end_date": "2020-08-06",
}'

Example Response

{
    "data": [
        {
            "id": 24204,
            "network": "infiniti",
            "shop_id": "4753",
            "apn_id": "264254",
            "action": "SearchResults",
            "label": "Appeared",
            "value": null,
            "created_at": "2020-08-06T15:52:33.000000Z",
            "updated_at": "2020-08-06T15:52:33.000000Z"
        },
        {
            "id": 23907,
            "network": "nissan",
            "shop_id": "4753",
            "apn_id": "264254",
            "action": "SearchResults",
            "label": "Appeared",
            "value": null,
            "created_at": "2020-08-06T14:08:08.000000Z",
            "updated_at": "2020-08-06T14:08:08.000000Z"
        },
        ...
    ]
}

# Fetch Action Details

HTTP POST /analytics/{apnId}/actions

Fetch a summary of all analytics actions.

URL Requirements

{apnId} - A valid APN ID

# Request Parameters

Name Type Description Required
start_date Date An ISO 8601 date ie 2019-01-01 No
end_date Date An ISO 8601 date ie 2020-01-01 No
network Enum null(all) | nissan | gtr | infiniti No

# Response

field Description
id A unique id for the action
network The network this record pertains to
apn_id The APN Id
action The action taken
label The action's location
value An optional value attributed to the action
created_at A timestamp for when the action was created
updated_at A timestamp for when the action was updated