AccountInsights
Allows you to get insights for an Instagram business account. Requires the instagram_basic and instagram_manage_insights scopes.
Select
You can query the following metrics given a date range. The default date range is the last 7 days.
- Impressions (accepts time periods of day, week, and days_28)
- Reach (accepts time periods of day, week, and days_28)
- FollowerCount (only accepts the day period)
- EmailContacts (only accepts the day period)
- PhoneCallClicks (only accepts the day period)
- TextMessageClicks (only accepts the day period)
- GetDirectionsClicks (only accepts the day period)
- WebsiteClicks (only accepts the day period)
- ProfileViews (only accepts the day period)
Specify a date range with the FromDateTime and ToDateTime columns. Specify the intervals of the date range by setting the Period column in the WHERE clause. Note that you cannot use a period on a metric that does not support it. For example, you cannot use Impressions AND FollowerCount with period days_28 because FollowerCount only supports the day period.
The add-in will use the Instagram APIs to process filters that refer to a date range or Id. The add-in processes other filters client-side within itself.
The following examples show how to retrieve metrics over a given date range:
-
The default query returns results for the following metrics during the last seven days: Impressions, Reach, FollowerCount, EmailContacts, PhoneCallClicks, TextMessageClicks, GetDirectionsClicks, WebsiteClicks, and ProfileViews.
SELECT * FROM AccountInsights
-
Filter on FromDateTime and ToDateTime to explicitly specify a different date range. The max date range cannot be more than 30 days (2592000 s).
SELECT * FROM AccountInsights WHERE FromDateTime = '2018/01/01' AND ToDateTime = '2018/01/30' AND period = 'day'
-
Return results over a period of 7 days.
SELECT * FROM AccountInsights WHERE FromDateTime = '2018/01/01' AND period = 'day'
-
Return results from 2018/01/01 to 2018/01/08.
SELECT * FROM AccountInsights WHERE ToDateTime = '2018/01/08' AND period = 'day'
-
Return a custom projection on account insights for the date range from 2018/01/01 to 2018/01/08.
SELECT Impressions, FollowerCount, EmailContacts FROM AccountInsights WHERE FromDateTime = '2018/01/01' AND ToDateTime = '2018/01/30' AND period = 'day'
Columns
Name | Type | Description |
InstagramBusinessAccountId | String | The unique identifier of the Instagram business account Id. |
EndTime | Date | The most recent date this insight data is relevant for. |
Impressions | Integer | Total number of times this profile has been seen. |
Reach | Integer | Total number of unique accounts that have seen this profile. |
ProfileViews | Integer | Total number of unique accounts that have viewed this profile within the specified period. |
FollowerCount | Integer | Total number of unique accounts following this profile. |
EmailContacts | Integer | Total number of taps on the email link in this profile. |
PhoneCallClicks | Integer | Total number of taps on the call link in this profile. |
TextMessageClicks | Integer | Total number of taps on the text message link in this profile. |
GetDirectionsClicks | Integer | Total number of taps on the directions link in this profile. |
Websiteclicks | Integer | Total number of taps on the website link in this profile. |
Period | String | The period for the insight. This controls how rows will be broken up (by day, week, 28 days, or lifetime). This must always be specified. |
Pseudo-Columns
Pseudo column fields are used in the WHERE clause of SELECT statements and offer a more granular control over the tuples that are returned from the data source.
Name | Type | Description |
FromDateTime | Datetime | The earliest time for insight data to have been collected. |
ToDateTime | Datetime | The latest time for insight data to have been collected. |