rvkstat (version 2.6.3)

vkGetAdGenderAgeStats: Statistics on Audience Coverage by Age and Gender.

Description

Returns statistics on the reach of advertising campaigns and ads by age and sex.

Usage

vkGetAdGenderAgeStats(account_id = NULL, ids_type = "campaign", ids = NULL,
                 period = "day", date_from = Sys.Date() - 30, date_to =
                 Sys.Date(), api_version = NULL, access_token = NULL)

Arguments

account_id

Advertising account ID, a list of all available advertising accounts can be obtained using the function vkGetAdAccounts.

ids_type

The type of objects requested, which are listed in the ids parameter. Valid ad values are ads, campaigns are campaigns.

ids

Vector id of the requested ads, campaigns, clients or account, depending on what is specified in the ids_type parameter.

period

The method of grouping data by date. day - statistics by days, month - statistics by months, overall - statistics for all time. Temporary restrictions are given by the arguments date_from and date_to.

date_from

The starting date of the displayed statistics in the format YYYY-MM-DD.

date_to

The end date of the displayed statistics in the format YYYY-MM-DD.

access_token

API access token, obtained using the functions vkAuth or vkGetToken.

api_version

Vkontakte API version.

Value

Date frame with community statistics with the following values:

1. id

id of the object from the ids argument.

2. day

(if the period is equal to day) day in the format YYYY-MM-DD.

3. month

(if period is equal to month) - day in the format YYYY-MM.

4. day_from

(if period is overall) the start date of the reporting period.

5. day_to

(if period is overall) end date of the reporting period.

6. type

object type from the ids_type parameter.

7. gender

gender.

8. age

age.

9. impressions_rate

part of the audience that viewed the ad, from 0 to 1.

10. clicks_rate

(the part of the audience that clicked on the ad, from 0 to 1.

Examples

Run this code
# NOT RUN {
## auth
my_tok <- vkAuth(app_id = 1, 
                 app_secret = "H2Pk8htyFD8024mZaPHm")

# 1.Get a static message on audience coverage by sex, 
# advertising campaigns in the context of days
## 1.1. We get a list of advertising campaigns
camp <- vkGetAdCampaigns(account_id = 1, access_token = my_tok$access_token)
## 1.2. We get statistics on advertising campaigns
vk_ad_gender_age_stat_day <- vkGetAdGenderAgeStats(account_id = 1,
                                                   ids_type = "campaign",
                                                   ids = camp$id ,
                                                   period = "day",
                                                   date_from = "2010-01-01", 
                                                   date_to = "2017-09-10",
                                                   access_token = my_tok$access_token)
										
										
# 2.Receive a static message on the ads in the context of months
## 2.1. We get a list of advertising campaigns
ads <- vkGetAds(account_id = account_id, access_token = my_tok$access_token)
## 2.2. Get ad statistics
vk_ad_gender_age_stat_month <- vkGetAdGenderAgeStats(account_id = 1,
                                                     ids_type = "ad",
                                                     ids = ads$id ,
                                                     period = "month",
                                                     date_from = "2010-01-01", 
                                                     date_to = "2017-09-10",
                                                     access_token = my_tok$access_token)
			
			
# 3.Get a static message on reaching the audience 
# for advertising campaigns without a temporary breakdown
## 3.1. We get a list of advertising campaigns
camp <- vkGetAdCampaigns(account_id = 1, access_token = my_tok$access_token)
## 3.2. We get statistics on advertising campaigns
vk_ad_gender_age_stat_total <- vkGetAdGenderAgeStats(account_id = 1,
                                                     ids_type = "campaign",
                                                     ids = camp$id ,
                                                     period = "overall",
                                                     date_from = "2010-01-01", 
                                                     date_to = "2017-09-10",
                                                     access_token = my_tok$access_token)

# }

Run the code above in your browser using DataCamp Workspace