Type: | Package |
Title: | R Interface to API 'vk.com' |
Version: | 3.2.0 |
Date: | 2021-10-15 |
Author: | Alexey Seleznev |
Maintainer: | Alexey Seleznev <selesnow@gmail.com> |
Description: | Load data from vk.com api about your communiti users and views, ads performance, post on user wall and etc. For more information see API Documentation https://vk.com/dev/first_guide. |
License: | GPL-2 |
Depends: | R (≥ 3.5.0) |
Imports: | dplyr (≥ 1.0.0), tidyr (≥ 1.0.0), jsonlite, httr, stringr, lgr |
Language: | ru |
Encoding: | UTF-8 |
BugReports: | https://github.com/selesnow/rvkstat/issues |
URL: | https://selesnow.github.io/rvkstat/ |
RoxygenNote: | 7.1.2 |
NeedsCompilation: | no |
Packaged: | 2021-10-18 08:48:31 UTC; Alsey |
Repository: | CRAN |
Date/Publication: | 2021-10-18 10:00:02 UTC |
R Interface to API 'vk.com'
Description
Load data from vk.com api about your communiti users and views, ads performance, post on user wall and etc. For more information see API Documentation <https://vk.com/dev/first_guide>.
Details
The DESCRIPTION file:
Package: | rvkstat |
Type: | Package |
Title: | R Interface to API 'vk.com' |
Version: | 3.2.0 |
Date: | 2021-10-15 |
Author: | Alexey Seleznev |
Maintainer: | Alexey Seleznev <selesnow@gmail.com> |
Description: | Load data from vk.com api about your communiti users and views, ads performance, post on user wall and etc. For more information see API Documentation <https://vk.com/dev/first_guide>. |
License: | GPL-2 |
Depends: | R (>= 3.5.0) |
Imports: | dplyr (>= 1.0.0), tidyr (>= 1.0.0), jsonlite, httr, stringr, lgr |
Language: | ru |
Encoding: | UTF-8 |
BugReports: | https://github.com/selesnow/rvkstat/issues |
URL: | https://selesnow.github.io/rvkstat/ |
RoxygenNote: | 7.1.2 |
Index of help topics:
rvkstat-package R Interface to API 'vk.com' vkAuth Authorization in 'Vkontakte' vkGetAdAccounts List of Advertising Account vkGetAdAgeStats Statistics on Audience Coverage by Age. vkGetAdBudget Budget of Advertising Cabinet 'Vkontakte'. vkGetAdCampaigns Campaign list vkGetAdCategories List of Possible Subjects of Advertisements vkGetAdCityStats Statistics on Audience Coverage in The Context of Cities. vkGetAdClients Client list. vkGetAdGenderAgeStats Statistics on Audience Coverage by Age and Gender. vkGetAdGenderStats Statistics on Audience Coverage by Gender. vkGetAdPostsReach Statistics on The Coverage of Advertising Entries 'Vkontakte'. vkGetAdStatistics Statistics of advertising in 'VKontakte'. vkGetAds List of Ads From 'Vkontakte'. vkGetAdsLayout Appearance of Advertisements. vkGetDbCities City Dictionary. vkGetDbCountries Country Dictionary. vkGetDbMetroStations Returns a List of Metro Stations vkGetDbRegions Regions list. vkGetDbSchools Returns a List of Schools vkGetDbUniversities Returns a List of Universities vkGetGroupMembers Returns a list of community members. vkGetGroupStat Statistics on visiting the community in 'Vkontakte'. vkGetGroupStatAge Community Statistics by User Age Bucket vkGetGroupStatCity Statistics of the Vkontakte community visitors by cities. vkGetGroupStatCountries Statistics of The Vkontakte Community Visitors By Country. vkGetGroupStatGender Loading data by gender of the community visitors vkGetGroupStatGenderAge Statistics on Age Groups And Gender of The 'VKontakte' Community. vkGetGroupStatPostReach Statistics of Posts on The Community Wall. vkGetGroupToken Get the Access Key of Community 'Vkontakte'. vkGetToken Get vkontakte developer token vkGetUserFriends Frend List in 'Vkontakte' vkGetUserGroups List of 'Vkontakte' communities. vkGetUserWall Get Posts From Userwall. vkLoadToken Load vkontakte developer token vkSetters Set rvkstat options
Author(s)
Alexey Seleznev
Maintainer: Alexey Seleznev <selesnow@gmail.com>
Authorization in 'Vkontakte'
Description
Allows you to get a token to access the API using the scheme Authorization Code Flow - https://vk.com/dev/authcode_flow_user
Usage
vkAuth(
username = getOption("rvkstat.username"),
app_id = getOption("rvkstat.app_id"),
app_secret = getOption("rvkstat.app_secret"),
api_version = getOption("rvkstat.api_version"),
token_path = vkTokenPath(),
reauth = FALSE,
skip_option = FALSE
)
Arguments
username |
Your vkontakte login. |
app_id |
Application ID, you can find it on the application settings page. |
app_secret |
Secure application key, you can find it on the application settings page. |
api_version |
API version. |
token_path |
Path to dir with credentials |
reauth |
boolean, do reauthorization if TRUE |
skip_option |
boolean, skip access token from options and environ variables if TRUE. |
Value
The list of credentials to work with the API Vkontakte
Author(s)
Alexey Seleznev
Examples
## Not run:
## Auth in VK
vkAuth(
username = 'your_login'
)
## End(Not run)
List of Advertising Account
Description
Returns a list of available advertising spaces.
Usage
vkGetAdAccounts(
username = getOption("rvkstat.username"),
api_version = getOption("rvkstat.api_version"),
token_path = vkTokenPath(),
access_token = getOption("rvkstat.access_token")
)
Arguments
username |
Your vkontakte login. |
api_version |
Vkontakte API version. |
token_path |
Path to dir with credentials |
access_token |
API access tokens obtained using vkAuth or vkGetToken functions |
Value
Date frame with a list of advertising offices and their parameters with the following values:
account_id |
ID of the advertising account. |
account_type |
Type of advertising office. |
account_status |
The status of the advertising office. (1 - active, 0 - inactive) |
access_role |
User privileges in the advertising office. |
Author(s)
Alexey Seleznev
References
Documentation for API method ads.getAccounts: https://vk.com/dev/ads.getAccounts
Examples
## Not run:
my_vk_acc <- vkGetAdAccounts()
## End(Not run)
Statistics on Audience Coverage by Age.
Description
Returns statistics on the reach of advertising campaigns and ads by age.
Usage
vkGetAdAgeStats(
account_id = getOption("rvkstat.account_id"),
ids_type = "campaign",
ids,
period = c("day", "month", "overall"),
date_from = Sys.Date() - 30,
date_to = Sys.Date(),
username = getOption("rvkstat.username"),
api_version = getOption("rvkstat.api_version"),
token_path = vkTokenPath(),
access_token = getOption("rvkstat.access_token")
)
Arguments
account_id |
The ID of the advertising account, a list of all available advertising offices can be obtained using the function vkGetAdAccounts. |
ids_type |
The type of objects requested that are listed in the ids parameter. Valid values "ad" - 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 way data is grouped by date is day-by-day statistics, month is month-by-month statistics, overall is all-time statistics. Time limits are specified in the date_from and date_to arguments. |
date_from |
The start date of the displayed statistics in the format YYYY-MM-DD. |
date_to |
End date of the displayed statistics in the format YYYY-MM-DD. |
username |
Your vkontakte login. |
api_version |
Vkontakte API version. |
token_path |
Path to dir with credentials |
access_token |
API access tokens obtained using vkAuth or vkGetToken functions |
Value
Date frame with community statistics with the following values:
id |
id of the object from the ids argument. |
day |
(if the period is equal to day) day in the format YYYY-MM-DD. |
month |
(if period is equal to month) - day in the format YYYY-MM. |
day_from |
(if period is overall) the start date of the reporting period. |
day_to |
(if period is overall) end date of the reporting period. |
type |
object type from the ids_type parameter. |
age |
age. |
impressions_rate |
part of the audience that viewed the ad, from 0 to 1. |
clicks_rate |
(the part of the audience that clicked on the ad, from 0 to 1. |
Author(s)
Alexey Seleznev
References
Documentation for API method ads.getDemographics: https://vk.com/dev/ads.getDemographics
Examples
## 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)
## 1.2. We get statistics on advertising campaigns
vk_ad_age_stat_day <- vkGetAdAgeStats(account_id = 1,
ids_type = "campaign",
ids = camp$id ,
period = "day",
date_from = "2010-01-01",
date_to = "2017-09-10")
# 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)
## 2.2. Get ad statistics
vk_ad_age_stat_month <- vkGetAdAgeStats(account_id = 1,
ids_type = "ad",
ids = ads$id ,
period = "month",
date_from = "2010-01-01",
date_to = "2017-09-10")
# 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)
## 3.2. We get statistics on advertising campaigns
vk_ad_age_stat_total <- vkGetAdAgeStats(account_id = 1,
ids_type = "campaign",
ids = camp$id ,
period = "overall",
date_from = "2010-01-01",
date_to = "2017-09-10")
## End(Not run)
Budget of Advertising Cabinet 'Vkontakte'.
Description
Returns the current balance of the advertising account Vkontakte.
Usage
vkGetAdBudget(
account_id = getOption("rvkstat.account_id"),
username = getOption("rvkstat.username"),
api_version = getOption("rvkstat.api_version"),
token_path = vkTokenPath(),
access_token = getOption("rvkstat.access_token")
)
Arguments
account_id |
Advertising account ID, a list of all available advertising accounts can be obtained using the function vkGetAdAccounts. |
username |
Your vkontakte login. |
api_version |
Vkontakte API version. |
token_path |
Path to dir with credentials |
access_token |
API access tokens obtained using vkAuth or vkGetToken functions |
Author(s)
Alexey Seleznev
References
Documentation for API method ads.getBudget: https://vk.com/dev/ads.getBudget
Examples
## Not run:
## auth
my_tok <- vkAuth(app_id = 1,
app_secret = "H2Pk8htyFD8024mZaPHm")
# Receive the rest of means from an advertising office
vk_budget <- vkGetAdBudget(account_id = 1,
access_token = my_tok$access_token)
## End(Not run)
Campaign list
Description
Returns a list of available advertising campaigns from the advertising office Vkontakte.
Usage
vkGetAdCampaigns(
account_id = vkCurrentAdAccount(),
client_id = vkCurrentClientAccount(),
include_deleted = TRUE,
campaign_ids = "null",
username = getOption("rvkstat.username"),
api_version = getOption("rvkstat.api_version"),
token_path = vkTokenPath(),
access_token = getOption("rvkstat.access_token")
)
Arguments
account_id |
The ID of the advertising account, a list of all available advertising offices can be obtained using the function vkGetAdAccounts. |
client_id |
Client identifier from which advertisements are requested. Available and required for advertising agencies. |
include_deleted |
Boolean TRUE or FALSE, flag, specifying the need to display archived ads. |
campaign_ids |
Campaing ids. |
username |
Your vkontakte login. |
api_version |
Vkontakte API version. |
token_path |
Path to dir with credentials |
access_token |
API access tokens obtained using vkAuth or vkGetToken functions |
Value
Date frame with a list of advertising offices and their parameters with the following values:
id |
campaign ID. |
type |
campaign type. |
name |
campaign name. |
status |
campaign status. |
day_limit |
daily campaign limit in rubles. |
all_limit |
total campaign limit in rubles. |
start_time |
campaign start time. |
stop_time |
campaign stop time. |
create_time |
campaign creation time. |
update_time |
the last time the campaign was modified. |
Author(s)
Alexey Seleznev
References
Documentation for API method ads.getCampaigns: https://vk.com/dev/ads.getCampaigns
Examples
## Not run:
## get campaing list
my_vk_camp <- vkGetAdCampaigns(account_id = 1)
## End(Not run)
List of Possible Subjects of Advertisements
Description
Returns a table with all possible topics and their subsections of the topics of advertisements from 'Vkontakte'
Usage
vkGetAdCategories(
version = c("v1", "v2"),
username = getOption("rvkstat.username"),
api_version = getOption("rvkstat.api_version"),
token_path = vkTokenPath(),
access_token = getOption("rvkstat.access_token")
)
Arguments
version |
Dictionary version, v1 include deprecated themes, v2 exclude deprecated themes. |
username |
Your vkontakte login. |
api_version |
Vkontakte API version. |
token_path |
Path to dir with credentials |
access_token |
API access tokens obtained using vkAuth or vkGetToken functions |
Value
Date frame with the following values:
id |
subject identifier. |
name |
subject name. |
subcategories_id |
identifier of the subsection. |
ubcategories_name |
subsection name. |
Author(s)
Alexey Seleznev
References
Documentation for API method ads.getCategories: https://vk.com/dev/ads.getCategories
Examples
## Not run:
# list of subjects
vk_ad_categories <- vkGetAdCategories()
## End(Not run)
Statistics on Audience Coverage in The Context of Cities.
Description
Returns statistics on audience reach by advertising campaign and ads by city.
Usage
vkGetAdCityStats(
account_id = vkCurrentAdAccount(),
ids_type = c("campaign", "ad"),
ids = NULL,
period = c("day", "month", "overall"),
date_from = Sys.Date() - 30,
date_to = Sys.Date(),
username = getOption("rvkstat.username"),
api_version = getOption("rvkstat.api_version"),
token_path = vkTokenPath(),
access_token = getOption("rvkstat.access_token")
)
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. |
username |
Your vkontakte login. |
api_version |
Vkontakte API version. |
token_path |
Path to dir with credentials |
access_token |
API access tokens obtained using vkAuth or vkGetToken functions |
Value
Date frame with the following values:
id |
id of the object from the ids argument. |
day |
(if the period is equal to day) day in the format YYYY-MM-DD. |
month |
(if period is equal to month) - day in the format YYYY-MM. |
day_from |
(if period is overall) the start date of the reporting period. |
day_to |
(if period is overall) the finish date of the reporting period. |
type |
the type of the object from the ids_type parameter. |
city_id |
city id or other for other cities. |
city_name |
city name. |
impressions_rate |
part of the audience that viewed the ad, from 0 to 1. |
clicks_rate |
(the part of the audience that clicked on the ad, from 0 to 1. |
Author(s)
Alexey Seleznev
References
Documentation for API method ads.getDemographics: https://vk.com/dev/ads.getDemographics
Examples
## Not run:
# 1.Get a static report on audience coverage in the context
# of cities by advertising campaigns by day
## 1.1. We get a list of advertising campaigns
camp <- vkGetAdCampaigns(account_id = 1)
## 1.2. We get statistics on advertising campaigns
vk_ad_city_stat_day <- vkGetAdCityStats(account_id = 1,
ids_type = "campaign",
ids = camp$id ,
period = "day",
date_from = "2010-01-01",
date_to = "2017-09-10")
# 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_city_stat_month <- vkGetAdCityStats(account_id = 1,
ids_type = "ad",
ids = ads$id ,
period = "month",
date_from = "2010-01-01",
date_to = "2017-09-10")
# 3.Receive a static report on audience coverage in the context
# of cities by advertising campaigns without a temporary breakdown
## 3.1. We get a list of advertising campaigns
camp <- vkGetAdCampaigns(account_id = 1)
##3.2. Get statistics on advertising campaigns
vk_ad_city_stat_total <- vkGetAdCityStats(account_id = 1,
ids_type = "campaign",
ids = camp$id ,
period = "overall",
date_from = "2010-01-01",
date_to = "2017-09-10")
## End(Not run)
Client list.
Description
Returns a list of advertising agency clients.
Usage
vkGetAdClients(
account_id = getOption("rvkstat.agency_id"),
username = getOption("rvkstat.username"),
api_version = getOption("rvkstat.api_version"),
token_path = vkTokenPath(),
access_token = getOption("rvkstat.access_token")
)
Arguments
account_id |
Advertising account ID, a list of all available advertising accounts can be obtained using the function vkGetAdAccounts. |
username |
Your vkontakte login. |
api_version |
Vkontakte API version. |
token_path |
Path to dir with credentials |
access_token |
API access tokens obtained using vkAuth or vkGetToken functions |
Value
Date frame with community statistics with the following values:
id |
client id. |
name |
customer name. |
day_limit |
client's daily limit in rubles. |
all_limit |
total customer limit in rubles. |
Author(s)
Alexey Seleznev
References
Documentation for API method ads.getClients: https://vk.com/dev/ads.getClients
Examples
## Not run:
## auth
my_tok <- vkAuth(app_id = 1,
app_secret = "H2Pk8htyFD8024mZaPHm")
## We get a list of clients from the agent account
vk_clients <- vkGetAdClients(account_id = 1,
access_token = my_tok$access_token)
## End(Not run)
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 = vkCurrentAdAccount(),
ids_type = c("campaign", "ad"),
ids = NULL,
period = c("day", "month", "overall"),
date_from = Sys.Date() - 30,
date_to = Sys.Date(),
username = getOption("rvkstat.username"),
api_version = getOption("rvkstat.api_version"),
token_path = vkTokenPath(),
access_token = getOption("rvkstat.access_token")
)
Arguments
account_id |
The ID of the advertising account, a list of all available advertising offices can be obtained using the function vkGetAdAccounts. |
ids_type |
The type of objects requested that are listed in the ids parameter. Valid ad values are ads, campaign campaigns, client clients, office office. |
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. |
username |
Your vkontakte login. |
api_version |
Vkontakte API version. |
token_path |
Path to dir with credentials |
access_token |
API access tokens obtained using vkAuth or vkGetToken functions |
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. |
Author(s)
Alexey Seleznev
References
Documentation for API method ads.getStatistics: https://vk.com/dev/ads.getStatistics
Examples
## Not run:
# 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)
## 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")
# 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)
## 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")
# 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)
## 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")
## End(Not run)
Statistics on Audience Coverage by Gender.
Description
Returns audience coverage statistics for advertising campaigns and ads by gender.
Usage
vkGetAdGenderStats(
account_id = vkCurrentAdAccount(),
ids_type = c("campaign", "ad"),
ids = NULL,
period = c("day", "month", "overall"),
date_from = Sys.Date() - 30,
date_to = Sys.Date(),
username = getOption("rvkstat.username"),
api_version = getOption("rvkstat.api_version"),
token_path = vkTokenPath(),
access_token = getOption("rvkstat.access_token")
)
Arguments
account_id |
The ID of the advertising account, a list of all available advertising offices can be obtained using the function vkGetAdAccounts. |
ids_type |
The type of objects requested that are listed in the ids parameter. Valid ad values are ads, campaign campaigns, client clients, office office. |
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. |
username |
Your vkontakte login. |
api_version |
Vkontakte API version. |
token_path |
Path to dir with credentials |
access_token |
API access tokens obtained using vkAuth or vkGetToken functions |
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, f - female, m - male. |
8. impressions_rate |
part of the audience that viewed the ad, from 0 to 1. |
9. clicks_rate |
(the part of the audience that clicked on the ad, from 0 to 1. |
Author(s)
Alexey Seleznev
References
Documentation for API method ads.getStatistics: https://vk.com/dev/ads.getStatistics
Examples
## Not run:
# 1.Get a stat 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)
## 1.2. We get statistics on advertising campaigns
vk_ad_gender_stat_day <- vkGetAdGenderStats(account_id = 1,
ids_type = "campaign",
ids = camp$id ,
period = "day",
date_from = "2010-01-01",
date_to = "2017-09-10")
# 2.Receive a stat message on the ads in the context of months
## 2.1. We get a list of advertising campaigns
ads <- vkGetAds(account_id = account_id)
## 2.2. Get ad statistics
vk_ad_gender_stat_month <- vkGetAdGenderStats(account_id = 1,
ids_type = "ad",
ids = ads$id ,
period = "month",
date_from = "2010-01-01",
date_to = "2017-09-10")
# 3.Get a stat 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 = )
## 3.2. We get statistics on advertising campaigns
vk_ad_gender_stat_total <- vkGetAdGenderStats(account_id = 1,
ids_type = "campaign",
ids = camp$id ,
period = "overall",
date_from = "2010-01-01",
date_to = "2017-09-10")
## End(Not run)
Statistics on The Coverage of Advertising Entries 'Vkontakte'.
Description
Returns detailed statistics on the reach of advertisements from ads and campaigns to promote community entries.
Usage
vkGetAdPostsReach(
account_id = vkCurrentAdAccount(),
ids_type = "campaign",
ids = NULL,
username = getOption("rvkstat.username"),
api_version = getOption("rvkstat.api_version"),
token_path = vkTokenPath(),
access_token = getOption("rvkstat.access_token")
)
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 of id of the requested ads, campaigns, clients or account, depending on what is specified in the ids_type parameter. |
username |
Your vkontakte login. |
api_version |
Vkontakte API version. |
token_path |
Path to dir with credentials |
access_token |
API access tokens obtained using vkAuth or vkGetToken functions |
Details
Campaign statistics are only available for campaigns created since December 20, 2016. The video_views_start, video_views_3s, video_views_25p, video_views_50p, video_views_75p, video_views_100p fields with video statistics data are returned only for ads or campaigns from videos created after January 26, 2017.
Value
Date frame with community statistics with the following values:
1. id |
object ID from the ids parameter. |
2. reach_subscribers |
reach subscribers. |
3. reach_total |
total coverage. |
4. links |
follow the link. |
5. to_group |
transitions to the community. |
6. join_group |
entry into the community. |
7. report |
number of complaints about the record. |
8. hide |
number of entries hidden. |
9. unsubscribe |
number of unsubscribe members. |
10. video_views_start |
number of starts to watch a video. |
11. video_views_3s |
number of video inspections up to 3 seconds. |
12. video_views_25p |
number of video inspections up to 25 percent. |
13. video_views_50p |
number of video inspections up to 50 percent. |
14. video_views_75p |
number of video inspections up to 75 percent. |
15. video_views_100p |
The number of video inspections is up to 100 percent. |
Author(s)
Alexey Seleznev
References
Documentation for API method ads.getPostsReach: https://vk.com/dev/ads.getPostsReach
Examples
## Not run:
## auth
my_tok <- vkAuth(app_id = 1, app_secret = "H2Pk8htyFD8024mZaPHm")
## camp list
camp <- vkGetAdCampaigns(account_id = 1,
access_token = my_tok$access_token)
## Get statistics on advertising campaigns
post_reach <- vkGetAdPostsReach(account_id = 1600134264,
ids_type = "campaign",
ids = camp$id,
access_token = my_tok$access_token)
## End(Not run)
Statistics of advertising in 'VKontakte'.
Description
returns performance statistics for advertisements, campaigns, customers, or the entire account.
Usage
vkGetAdStatistics(
account_id = vkCurrentAdAccount(),
ids_type = c("office", "client", "campaign", "ad"),
ids,
period = c("day", "week", "month", "year", "overall"),
date_from = Sys.Date() - 30,
date_to = Sys.Date(),
username = getOption("rvkstat.username"),
api_version = getOption("rvkstat.api_version"),
token_path = vkTokenPath(),
access_token = getOption("rvkstat.access_token")
)
Arguments
account_id |
The ID of the advertising account, a list of all available advertising offices can be obtained using the function vkGetAdAccounts. |
ids_type |
The type of objects requested that are listed in the ids parameter. Valid ad values are ads, campaign campaigns, client clients, office office. |
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. |
username |
Your vkontakte login. |
api_version |
Vkontakte API version. |
token_path |
Path to dir with credentials |
access_token |
API access tokens obtained using vkAuth or vkGetToken functions |
Value
Date frame with advertising 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. spent |
money spent. |
8. impressions |
number of views. |
9. clicks |
number of unique visitors. |
10. reach |
(if ids_type is ad or campaign and period is equal to day or month) - coverage. |
11. video_views |
(if ids_type is ad) - video views (for video ads). |
12. video_views_half |
(if ids_type is ad) - half the video views (for video ads) |
13. video_views_full |
(if ids_type is ad) - views of the whole video (for video ads). |
14. video_clicks_site |
(if ids_type is equal to ad) - transitions to the advertiser’s website from video ads (for video ads). |
15. join_rate |
(if ids_type is ad or campaign) - group membership, event, subscriptions to a public page or application settings (only if the ad contains a direct link to the corresponding VK page). |
16. lead_form_sends |
ount of sended lead forms from your ads. |
Author(s)
Alexey Seleznev
References
Documentation for API method ads.getStatistics: https://vk.com/dev/ads.getStatistics
Examples
## Not run:
# 1.Get a static message on 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_stat_by_campaign <- vkGetAdStatistics(account_id = 1,
ids_type = "campaign",
ids = camp$id ,
period = "day",
date_from = "2010-01-01",
date_to = "2017-09-10")
# 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)
## 2.2. Get ad statistics
vk_stat_by_ads <- vkGetAdStatistics(account_id = 1,
ids_type = "ad",
ids = ads$id ,
period = "month",
date_from = "2010-01-01",
date_to = "2017-09-10")
# 3.Receive the general static of the advertising cabinet, in this example
# it is assumed that the id of the advertising cabinet is 1
vk_stat_by_account <- vkGetAdStatistics(account_id = 1,
ids_type = "office",
ids = 1,
period = "overall",
date_from = "2010-01-01",
date_to = "2017-09-10")
## End(Not run)
List of Ads From 'Vkontakte'.
Description
Provide to get a list of advertisements from the advertising office 'Vkontakte'.
Usage
vkGetAds(
account_id = vkCurrentAdAccount(),
client_id = vkCurrentClientAccount(),
include_deleted = TRUE,
only_deleted = FALSE,
campaign_ids = "null",
ad_ids = "null",
status_names = TRUE,
username = getOption("rvkstat.username"),
api_version = getOption("rvkstat.api_version"),
token_path = vkTokenPath(),
access_token = getOption("rvkstat.access_token")
)
Arguments
account_id |
The ID of the advertising account, a list of all available advertising offices can be obtained using the function vkGetAdAccounts. |
client_id |
Client identifier from which advertisements are requested. Available and required for advertising agencies. |
include_deleted |
Boolean TRUE or FALSE, flag, specifying the need to display archived ads. |
only_deleted |
Boolean TRUE or FALSE, flag, get only deleted ads. |
campaign_ids |
Numeric vector, filter by advertising campaigns. |
ad_ids |
Numeric vector, ad filter. |
status_names |
If TRUE you get status names, in FALSE status Ids. |
username |
Your vkontakte login. |
api_version |
Vkontakte API version. |
token_path |
Path to dir with credentials |
access_token |
API access tokens obtained using vkAuth or vkGetToken functions |
Details
If campaign_ids and ad_ids filters are enabled at the same time, the following ads will be displayed: 1. If the ad id is specified in ad_ids, then it is displayed. 2. If the ad belongs to an advertising campaign whose id is specified in campaign_ids, then it is displayed. 3. If there is an ad with the id specified in ad_ids and it belongs to a campaign whose id is specified in campaign_ids, then this ad campaign is ignored, i.e. for her, rule 2 does not work.
No more than 2000 ads are output from no more than 2000 campaigns.
Value
Date frame with the following values:
id |
ad id. |
campaign_id |
campaign id. |
name |
name of the announcement. |
status |
ad status. |
ad_format |
ad format. |
approved |
ad moderation status. |
all_limit |
total ad limit in rubles. 0 - no limit is set. |
create_time |
date and time of ad creation. |
9. update_time |
the date and time of the last ad change. |
10. age_restriction |
label about ad age limit. |
11. category1_id |
ID of the subject or subsection of the subject of the announcement, a list of topics can be obtained using the function vkGetAdCategories. |
12. category2_id |
Subject ID or sub topic of the ad. Additional topics, a list of topics can be obtained using the function vkGetAdCategories. |
13. cost_type |
type of payment. |
14. cpc |
price per switch in kopecks. |
15. cpm |
price per 1000 impressions in kopecks. |
16. impressions_limit |
limit the number of times this ad is shown per user. |
17. impressions_limited |
a sign that the number of ad impressions per user is limited. |
18. ad_platform |
advertising platforms where the ad will be displayed. (if ad_format is 1, 0 - VKontakte and partner sites, 1 - only VKontakte, (if ad_format is 9) all - all sites, desktop - full version of the site, mobile - mobile site and applications.) |
19. video |
1 - the ad is a video ad. |
Author(s)
Alexey Seleznev
References
Documentation for API method ads.getAds: https://vk.com/dev/ads.getAds
Examples
## Not run:
## auth
my_tok <- vkAuth(app_id = 1,app_secret = "H2Pk8htyFD8024mZaPHm")
# ads list
my_vk_ads <- vkGetAds(account_id = 11111111,
access_token = my_tok$access_token)
## End(Not run)
Appearance of Advertisements.
Description
Allows you to get a list of advertisements and a description of their appearance from the advertising office 'Vkontakte'.
Usage
vkGetAdsLayout(
account_id = vkCurrentAdAccount(),
client_id = vkCurrentClientAccount(),
include_deleted = TRUE,
only_deleted = FALSE,
campaign_ids = "null",
ad_ids = "null",
status_names = TRUE,
username = getOption("rvkstat.username"),
api_version = getOption("rvkstat.api_version"),
token_path = vkTokenPath(),
access_token = getOption("rvkstat.access_token")
)
Arguments
account_id |
Advertising account ID, a list of all available advertising accounts can be obtained using the function vkGetAdAccounts. |
client_id |
Client identifier from which advertisements are requested. Available and required for advertising agencies. |
include_deleted |
Boolean TRUE or FALSE, flag, specifying whether to display archived ads. |
only_deleted |
Boolean TRUE or FALSE, flag, get only deleted ads. |
campaign_ids |
Numeric vector, filter by advertising campaigns. |
ad_ids |
Numeric vector, ad filter. |
status_names |
Numeric vector, filter by advertising campaigns. |
username |
Your vkontakte login. |
api_version |
Vkontakte API version. |
token_path |
Path to dir with credentials |
access_token |
API access tokens obtained using vkAuth or vkGetToken functions |
Details
If campaign_ids and ad_ids filters are enabled at the same time, the following ads will be displayed: 1. If the ad id is specified in ad_ids, then it is displayed. 2. If the ad belongs to an advertising campaign whose id is specified in campaign_ids, then it is displayed. 3. If there is an ad with the id specified in ad_ids and it belongs to a campaign whose id is specified in campaign_ids, then this ad campaign is ignored, i.e. for her, rule 2 does not work.
No more than 2000 ads are output from no more than 2000 campaigns.
The function is based on the API method ads.getAdsLayout, you can find out all the details of its work at https://vk.com/dev/ads.getAdsLayout.
Value
Data frame with next values:
1. id |
ad id. |
2. campaign_id |
campaign id. |
3. ad_format |
ad format. |
4. cost_type |
type of payment. |
5. video |
1 - the ad is a video ad. |
6. title |
ad title. |
7. description |
description of the advertisement. |
8. link_url |
link to the advertised object. |
9. link_domain |
domain of the advertised site.. |
10. preview_link |
link by clicking on which you can view the advertisement as it looks on the site. The link is available for 30 minutes after the vkGetAdsLayout function. |
11. image_src |
ad image url. |
Author(s)
Alexey Seleznev
References
Documentation for API method ads.getAdsLayout: https://vk.com/dev/ads.getAdsLayout
Examples
## Not run:
# get Ads Layouts
my_vk_ads <- vkGetAdsLayout(account_id = 11111111)
## End(Not run)
City Dictionary.
Description
Returns a list of cities and countries.
Usage
vkGetDbCities(
country_id,
region_id = NULL,
q = NULL,
need_all = TRUE,
username = getOption("rvkstat.username"),
api_version = getOption("rvkstat.api_version"),
token_path = vkTokenPath(),
access_token = getOption("rvkstat.access_token")
)
Arguments
country_id |
country identifier obtained using the vkGetDbCountries function. |
region_id |
identifier of the region whose city you want to receive. (this parameter is optional. |
q |
search query string. For example, "Saint". The maximum string length is 15 characters. |
need_all |
Boolean TRUE or FALSE, flag — return a list of all countries. |
username |
Your vkontakte login. |
api_version |
Vkontakte API version. |
token_path |
Path to dir with credentials |
access_token |
API access tokens obtained using vkAuth or vkGetToken functions |
Details
the q parameter is not specified, then a list of the largest cities in the given country will be returned. If the q parameter is specified, a list of cities that are relevant to the search query will be returned.
Value
Date frame with community statistics with the following values:
cid |
country id. |
title |
country name. |
important |
mark key cities for the current user. |
area |
area. |
region |
region. |
Author(s)
Alexey Seleznev
References
Documentation for API method database.getCities: https://vk.com/dev/database.getCities
Examples
## Not run:
## Get a list of cities for Ukraine, because Ukraine id = 2
vk_cities <- vkGetDbCities(country_id = 2)
## Get the list of cities for the search query "St."
vk_cities_search <- vkGetDbCities(country_id = 1,
q = "St.")
## End(Not run)
Country Dictionary.
Description
Get list of countries.
Usage
vkGetDbCountries(
need_all = TRUE,
code = NULL,
username = getOption("rvkstat.username"),
api_version = getOption("rvkstat.api_version"),
token_path = vkTokenPath(),
access_token = getOption("rvkstat.access_token")
)
Arguments
need_all |
Boolean TRUE or FALSE, flag — return a list of all countries. |
code |
Text vector, two-letter codes of countries in ISO 3166-1 alpha-2, for which you need to give information. Example c ("RU", "UA", "BY"), a list of all codes can be viewed at the link - https://vk.com/dev/country_codes. |
username |
Your vkontakte login. |
api_version |
Vkontakte API version. |
token_path |
Path to dir with credentials |
access_token |
API access tokens obtained using vkAuth or vkGetToken functions |
Details
If the need_all and code parameters are not specified, then a short list of countries located closest to the current user's country is returned. If the need_all parameter is specified, a list of all countries will be returned. If the code parameter is specified, only countries with the listed ISO 3166-1 alpha-2 codes will be returned. A list of all country codes can be obtained at the link - https://vk.com/dev/country_codes
Value
Date frame with community statistics with the following values:
1. cid |
country id. |
2. title |
country name. |
Author(s)
Alexey Seleznev
References
Documentation for API method database.getCountries: https://vk.com/dev/database.getCountries
Examples
## Not run:
## get dictionary
vk_countries <- vkGetDbCountries(need_all = T,
code = c("RU","UA","BY"))
## End(Not run)
Returns a List of Metro Stations
Description
Returns a List of Metro Stations
Usage
vkGetDbMetroStations(
city_id,
username = getOption("rvkstat.username"),
api_version = getOption("rvkstat.api_version"),
token_path = vkTokenPath(),
access_token = getOption("rvkstat.access_token")
)
Arguments
city_id |
City ID, |
username |
Your vkontakte login. |
api_version |
Vkontakte API version. |
token_path |
Path to dir with credentials |
access_token |
API access tokens obtained using vkAuth or vkGetToken functions |
Value
tibble with Metro Stations list
Regions list.
Description
Get regions dictionary.
Usage
vkGetDbRegions(
country_id,
q = NULL,
username = getOption("rvkstat.username"),
api_version = getOption("rvkstat.api_version"),
token_path = vkTokenPath(),
access_token = getOption("rvkstat.access_token")
)
Arguments
country_id |
country identifier obtained using the vkGetDbCountries function. |
q |
search query string. For example, Len. The maximum string length is 15 characters. |
username |
Your vkontakte login. |
api_version |
Vkontakte API version. |
token_path |
Path to dir with credentials |
access_token |
API access tokens obtained using vkAuth or vkGetToken functions |
Details
If the q parameter is not specified, then a list of all regions in the given country will be returned. If the q parameter is specified, a list of regions that are relevant to the search query will be returned.
Value
Data frame contains community statistics with the following values:
1. region_id |
region identifier. |
2. title |
name of the region. |
Author(s)
Alexey Seleznev
References
Documentation for API method database.getRegions: https://vk.com/dev/database.getRegions
Examples
## Not run:
## auth
my_tok <- vkAuth(app_id = 1,
app_secret = "H2Pk8htyFD8024mZaPHm")
## Get a list of regions for Ukraine, because Ukraine id = 2
vk_regions <- vkGetDbRegions(country_id = 2,
access_token = my_tok$access_token)
##get a list of cities of Ukraine on request "Ode"
vk_regions_search <- vkGetDbRegions(country_id = 2,
q = "Ode",
access_token = my_tok$access_token)
## End(Not run)
Returns a List of Schools
Description
Returns a List of Schools
Usage
vkGetDbSchools(
q = NULL,
city_id = NULL,
username = getOption("rvkstat.username"),
api_version = getOption("rvkstat.api_version"),
token_path = vkTokenPath(),
access_token = getOption("rvkstat.access_token")
)
Arguments
q |
Search query string. |
city_id |
City ID, |
username |
Your vkontakte login. |
api_version |
Vkontakte API version. |
token_path |
Path to dir with credentials |
access_token |
API access tokens obtained using vkAuth or vkGetToken functions |
Value
tibble with Schools list
Returns a List of Universities
Description
Returns a List of Universities
Usage
vkGetDbUniversities(
q = NULL,
country_id = NULL,
city_id = NULL,
username = getOption("rvkstat.username"),
api_version = getOption("rvkstat.api_version"),
token_path = vkTokenPath(),
access_token = getOption("rvkstat.access_token")
)
Arguments
q |
Search query string. |
country_id |
Country ID, |
city_id |
City ID, |
username |
Your vkontakte login. |
api_version |
Vkontakte API version. |
token_path |
Path to dir with credentials |
access_token |
API access tokens obtained using vkAuth or vkGetToken functions |
Value
tibble with Universities list
Returns a list of community members.
Description
Returns a list of community members.
Usage
vkGetGroupMembers(
group_id = NULL,
sort = c('time_desc', 'time_asc', 'id_desc', 'id_asc'),
fields = c('sex', 'bdate', 'city', 'country', 'photo_50', 'photo_100',
'photo_200_orig', 'photo_200', 'photo_400_orig', 'photo_max',
'photo_max_orig', 'online', 'online_mobile', 'lists', 'domain',
'has_mobile', 'contacts', 'connections', 'site', 'education',
'universities', 'schools', 'can_post', 'can_see_all_posts',
'can_see_audio', 'can_write_private_message', 'status',
'last_seen', 'common_count', 'relation', 'relatives'),
filter = c('all', 'friends', 'unsure', 'managers', 'donut'),
username = getOption("rvkstat.username"),
api_version = getOption("rvkstat.api_version"),
token_path = vkTokenPath(),
access_token = getOption("rvkstat.access_token")
)
Arguments
group_id |
Community ID or short name. |
sort |
sort with which to return the list of participants. Possible values: time_desc, time_asc, id_desc, id_asc. |
fields |
List of additional fields to return. Possible values: sex, bdate, city, country, photo_50, photo_100, photo_200_orig, photo_200, photo_400_orig, photo_max, photo_max_orig, online, online_mobile, lists, domain, has_mobile, contacts, connections, site, education, universities, schools, can_post, can_see_all_posts, can_see_audio, can_write_private_message, status, last_seen, common_count, relation, relatives |
filter |
Group member filter. Possible values: all, friends, unsure, managers, donut |
username |
Your vkontakte login. |
api_version |
Vkontakte API version. |
token_path |
Path to dir with credentials |
access_token |
API access tokens obtained using vkAuth or vkGetToken functions |
Value
Date frame with community statistics with the following values
Author(s)
Alexey Seleznev
References
Documentation for API method stats.get: https://vk.com/dev/groups.getMembers
Examples
## Not run:
## Getting community members
communityMembers <- vkGetGroupStat(
group_id = "data_club")
## End(Not run)
Statistics on visiting the community in 'Vkontakte'.
Description
Load data from the 'Vkontakte' communities by the number of views, subscriptions, replies and community visitors by date.
Usage
vkGetGroupStat(
date_from = Sys.Date() - 7,
date_to = Sys.Date(),
group_id = NULL,
interval = "day",
intervals_count = NULL,
filters = NULL,
stats_groups = c("visitors", "reach", "activity"),
username = getOption("rvkstat.username"),
api_version = getOption("rvkstat.api_version"),
token_path = vkTokenPath(),
access_token = getOption("rvkstat.access_token")
)
Arguments
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. |
group_id |
Community ID. |
interval |
Time intervals. Possible values: day, week, month, year, all. |
intervals_count |
Number of time intervals. |
filters |
A list of words separated by commas |
stats_groups |
Filter for getting data on a specific block of community statistics. Possible values: visitors, reach, activity. |
username |
Your vkontakte login. |
api_version |
Vkontakte API version. |
token_path |
Path to dir with credentials |
access_token |
API access tokens obtained using vkAuth or vkGetToken functions |
Value
Date frame with community statistics with the following values:
1. day |
date for which statistics is given. |
2. views |
number of views. |
3. visitors |
number of unique visitors. |
4. total_reach |
full coverage. |
5. subscribers_reach |
subscribers reach. |
6. subscribed |
number of new subscribers. |
7. unsubscribed |
number of unsubscribed. |
Author(s)
Alexey Seleznev
References
Documentation for API method stats.get: https://vk.com/dev/stats.get
Examples
## Not run:
## Getting community statistics
communityData <- vkGetGroupStat(date_from = "2021-01-01",
date_to = "2021-01-12",
group_id = 1)
## End(Not run)
Community Statistics by User Age Bucket
Description
Load data about community visitors by age group (12-18, 18-21, 21-24, 24-27, 27-30, 30-35, 35-45, 45-100) on dates.
Usage
vkGetGroupStatAge(
date_from = Sys.Date() - 7,
date_to = Sys.Date(),
group_id = NULL,
interval = "day",
intervals_count = NULL,
filters = NULL,
stats_groups = c("visitors", "reach", "activity"),
username = getOption("rvkstat.username"),
api_version = getOption("rvkstat.api_version"),
token_path = vkTokenPath(),
access_token = getOption("rvkstat.access_token")
)
Arguments
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. |
group_id |
Community ID. |
interval |
Time intervals. Possible values: day, week, month, year, all. |
intervals_count |
Number of time intervals. |
filters |
A list of words separated by commas |
stats_groups |
Filter for getting data on a specific block of community statistics. Possible values: visitors, reach, activity. |
username |
Your vkontakte login. |
api_version |
Vkontakte API version. |
token_path |
Path to dir with credentials |
access_token |
API access tokens obtained using vkAuth or vkGetToken functions |
Value
Date frame with statistics on community visitors with the following values:
1. Date |
the date for which statistics are given. |
2. Visitors |
number of unique visitors. |
3. AgeGroup |
age interval. |
Author(s)
Alexey Seleznev
References
Documentation for API method stats.get: https://vk.com/dev/stats.get
Examples
## Not run:
## auth
my_tok <- vkAuth(app_id = 1,app_secret = "H2Pk8htyFD8024mZaPHm")
## Get statistics on age groups of visitors
communityDataAge <- vkGetGroupStatAge(date_from = "2016-01-01",
date_to = "2016-04-01",
group_id = 1,
access_token = my_tok$access_token)
## End(Not run)
Statistics of the Vkontakte community visitors by cities.
Description
The function vkGetGroupStatCity allows you to get data about the city of community visitors by date.
Usage
vkGetGroupStatCity(
date_from = Sys.Date() - 7,
date_to = Sys.Date(),
group_id = NULL,
interval = "day",
intervals_count = NULL,
filters = NULL,
stats_groups = c("visitors", "reach", "activity"),
username = getOption("rvkstat.username"),
api_version = getOption("rvkstat.api_version"),
token_path = vkTokenPath(),
access_token = getOption("rvkstat.access_token")
)
Arguments
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. |
group_id |
Community ID. |
interval |
Time intervals. Possible values: day, week, month, year, all. |
intervals_count |
Number of time intervals. |
filters |
A list of words separated by commas |
stats_groups |
Filter for getting data on a specific block of community statistics. Possible values: visitors, reach, activity. |
username |
Your vkontakte login. |
api_version |
Vkontakte API version. |
token_path |
Path to dir with credentials |
access_token |
API access tokens obtained using vkAuth or vkGetToken functions |
Value
Date frame with statistics on community visitors with the following values:
Date |
date for which statistics is given. |
Visitors |
number of unique visitors. |
CityID |
city identifier or "other" for the "other cities" section. |
CityName |
city name. |
Author(s)
Alexey Seleznev
References
Documentation for API method stats.get: https://vk.com/dev/stats.get
Examples
## Not run:
## load statistic
communityDataCity <- vkGetGroupStatCity(
date_from = "2016-01-01",
date_to = "2016-04-01",
group_id = 1)
## End(Not run)
Statistics of The Vkontakte Community Visitors By Country.
Description
Allows you to get data about the city of community visitors by date.
Usage
vkGetGroupStatCountries(
date_from = Sys.Date() - 7,
date_to = Sys.Date(),
group_id = NULL,
interval = "day",
intervals_count = NULL,
filters = NULL,
stats_groups = c("visitors", "reach", "activity"),
username = getOption("rvkstat.username"),
api_version = getOption("rvkstat.api_version"),
token_path = vkTokenPath(),
access_token = getOption("rvkstat.access_token")
)
Arguments
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. |
group_id |
Community ID. |
interval |
Time intervals. Possible values: day, week, month, year, all. |
intervals_count |
Number of time intervals. |
filters |
A list of words separated by commas |
stats_groups |
Filter for getting data on a specific block of community statistics. Possible values: visitors, reach, activity. |
username |
Your vkontakte login. |
api_version |
Vkontakte API version. |
token_path |
Path to dir with credentials |
access_token |
API access tokens obtained using vkAuth or vkGetToken functions |
Value
Date frame with statistics on community visitors with the following values:
Date |
date for which statistics is given. |
Visitors |
number of unique visitors. |
CountryID |
country identifier |
CountryCode |
two-letter country code (for example, "RU"). |
CountryName |
country name. |
Author(s)
Alexey Seleznev
References
Documentation for API method stats.get: https://vk.com/dev/stats.get
Examples
## Not run:
## auth
## load data
communityDataCountry <- vkGetGroupStatCountries(
date_from = "2016-01-01",
date_to = "2016-04-01",
group_id = 1)
## End(Not run)
Loading data by gender of the community visitors
Description
Allows you to download data on the gender of community visitors by date.
Usage
vkGetGroupStatGender(
date_from = Sys.Date() - 7,
date_to = Sys.Date(),
group_id = NULL,
interval = "day",
intervals_count = NULL,
filters = NULL,
stats_groups = c("visitors", "reach", "activity"),
username = getOption("rvkstat.username"),
api_version = getOption("rvkstat.api_version"),
token_path = vkTokenPath(),
access_token = getOption("rvkstat.access_token")
)
Arguments
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. |
group_id |
Community ID. |
interval |
Time intervals. Possible values: day, week, month, year, all. |
intervals_count |
Number of time intervals. |
filters |
A list of words separated by commas |
stats_groups |
Filter for getting data on a specific block of community statistics. Possible values: visitors, reach, activity. |
username |
Your vkontakte login. |
api_version |
Vkontakte API version. |
token_path |
Path to dir with credentials |
access_token |
API access tokens obtained using vkAuth or vkGetToken functions |
Value
Date frame with statistics on community visitors with the following values:
1. Date |
the date for which statistics are given. |
2. Visitors |
number of unique visitors. |
3. Gender |
gender ("m" is male, "f" is female). |
Author(s)
Alexey Seleznev
References
Documentation for API method stats.get: https://vk.com/dev/stats.get
Examples
## Not run:
## auth
my_tok <- vkAuth(app_id = 1,app_secret = "H2Pk8htyFD8024mZaPHm")
## load data about users by gender
communityDataGender <- vkGetGroupStatGender(
date_from = "2016-01-01",
date_to = "2016-04-01",
group_id = 1,
access_token = my_tok$access_token)
## End(Not run)
Statistics on Age Groups And Gender of The 'VKontakte' Community.
Description
Provide to load to download statistics on the sex and age group of community visitors by date.
Usage
vkGetGroupStatGenderAge(
date_from = Sys.Date() - 7,
date_to = Sys.Date(),
group_id = NULL,
interval = "day",
intervals_count = NULL,
filters = NULL,
stats_groups = c("visitors", "reach", "activity"),
username = getOption("rvkstat.username"),
api_version = getOption("rvkstat.api_version"),
token_path = vkTokenPath(),
access_token = getOption("rvkstat.access_token")
)
Arguments
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. |
group_id |
Community ID. |
interval |
Time intervals. Possible values: day, week, month, year, all. |
intervals_count |
Number of time intervals. |
filters |
A list of words separated by commas |
stats_groups |
Filter for getting data on a specific block of community statistics. Possible values: visitors, reach, activity. |
username |
Your vkontakte login. |
api_version |
Vkontakte API version. |
token_path |
Path to dir with credentials |
access_token |
API access tokens obtained using vkAuth or vkGetToken functions |
Value
Date frame with statistics on community visitors with the following values:
1. Date |
the date for which statistics are given. |
2. Visitors |
number of unique visitors. |
3. Gender |
gender ("m" is male, "f" is female). |
4. AgeGroup |
age interval. |
Author(s)
Alexey Seleznev
References
Documentation for API method stats.get: https://vk.com/dev/stats.get
Examples
## Not run:
## Loading data by users by gender and age group
communityDataGenderAge <- vkGetGroupStatGenderAge(
date_from = "2016-01-01",
date_to = "2016-04-01",
group_id = 1,
access_token = my_tok$access_token)
## End(Not run)
Statistics of Posts on The Community Wall.
Description
Returns statistics for writing to the wall.
Usage
vkGetGroupStatPostReach(
owner_id,
post_ids,
username = getOption("rvkstat.username"),
api_version = getOption("rvkstat.api_version"),
token_path = vkTokenPath(),
access_token = getOption("rvkstat.access_token")
)
Arguments
owner_id |
community ID - the owner of the entry. Indicated with a minus sign. |
post_ids |
vector containing record identifiers, please note - statistics data are available only for the 300 latest (most recent) posts on the community wall. |
username |
Your vkontakte login. |
api_version |
Vkontakte API version. |
token_path |
Path to dir with credentials |
access_token |
API access tokens obtained using vkAuth or vkGetToken functions |
Details
Statistics records are currently available only to communities with the number of participants from 5000 and above, as well as official communities.
Please note - statistics data are available only for the latest 300 (most recent) posts on the community wall. Common errors may occur during execution. Their description is on a separate page - https://vk.com/dev/errors.
Value
Date frame with the following values:
1. reach_viral |
viral coverage (if recording was promoted with targeted advertising) |
2. reach_ads |
advertising reach (if the record was promoted using targeted advertising). |
3. reach_subscribers |
reach subscribers. |
4. reach_total |
total coverage. |
5. links |
follow the link. |
6. to_group |
transitions to the community. |
7. join_group |
entry into the community. |
8. report |
number of complaints about the record. |
9. hide |
number of entries hiding. |
10. unsubscribe |
number of unsubscribe members. |
11. post_id |
post id. |
Author(s)
Alexey Seleznev
References
Documentation for API method stats.getPostReach: https://vk.com/dev/stats.getPostReach
Examples
## Not run:
## auth
my_tok <- vkAuth(app_id = 1,
app_secret = "H2Pk8htyFD8024mZaPHm")
## Get the list of community messages
my_vk_wall <- vkGetUserWall(user_id = -111111,
access_token = my_tok$access_token)
## Get sub-stats for the latest 300 community entries
post_reach <- vkGetGroupStatPostReach(owner_id = -2222222,
post_ids = my_vk_wall$id,
access_token = my_tok$access_token)
## End(Not run)
Get the Access Key of Community 'Vkontakte'.
Description
This key allows you to work with the API on behalf of a group, meeting or public page. For example, with its help you can respond to community subscribers to messages received in its address. With the community access key, you can call those methods that have a special mark in the general list (https://vk.com/dev/methods). The vkGetGroupToken function gets the community access key using the Implicit flow scheme (https://vk.com/dev/implicit_flow_group).
Usage
vkGetGroupToken(
app_id = getOption("rvkstat.app_id"),
group_ids = NULL
)
Arguments
app_id |
The ID of your Vkontakte application, which is located in the "Application ID" field in the application settings. |
group_ids |
A vector containing the ID of the groups to which you want to get an access code. |
Value
Object containing a group access token
Author(s)
Alexey Seleznev
Examples
## Not run:
## Get vk api token, where 1 is the application ID,
## and 11,22,33 is the group ID.
myToken <- vkGetGroupToken(appId = 1,
group_ids = c(11,22,33))
## End(Not run)
Get vkontakte developer token
Description
vkGetToken open web link in browser and generate developer token, which you need for work with vk.com api
Usage
vkGetToken(app_id = getOption("rvkstat.app_id"))
Arguments
app_id |
Your app id from filed in app page vkontakte. |
Value
R object with vk.com token
Author(s)
Alexey Seleznev
Examples
## Not run:
## Get vk api token
myToken <- vkGetToken(app_id = "1")
## End(Not run)
Frend List in 'Vkontakte'
Description
Returns a list of user friends identifiers and extended information about the user's friends.
Usage
vkGetUserFriends(
user_id = NULL,
name_case = "nom",
username = getOption("rvkstat.username"),
api_version = getOption("rvkstat.api_version"),
token_path = vkTokenPath(),
access_token = getOption("rvkstat.access_token")
)
Arguments
user_id |
user ID for which you want to get a list of friends. If the parameter is not specified, it is considered that it is equal to the identifier of the current user. |
name_case |
case for declining the user's first and last name. Possible values: nominative - nom, genitive - gen, dative - dat, accusative - acc, ablative - ins, prepositional - abl. Default nom. |
username |
Your vkontakte login. |
api_version |
Vkontakte API version. |
token_path |
Path to dir with credentials |
access_token |
API access tokens obtained using vkAuth or vkGetToken functions |
Value
Date frame with community statistics with the following values:
1. user_id |
user id. |
2. first_name |
name. |
3. last_name |
last name |
4. gender |
sex. |
5. nickname |
nickname of the user. |
6. domain |
short page address. Returns a string containing the short address of the page (for example, andrew). If not assigned, it returns "id" + user_id, for example, id35828305. |
7. bdate |
date of birth. Returns in the format D.M.YYYY or D.M (if the year of birth is hidden). If the date of birth is hidden entirely, the field is absent in the answer. |
8. city |
city id, city name can be obtained using the function vkGetDbCities. |
9. country |
country id, country name can be obtained using the function vkGetDbCountries. |
10. photo_50 |
url of a square photo of a user having a width of 50 pixels. If the user does not have a photo, he returns http://vk.com/images/camera_c.gif. |
11. photo_100 |
url of a square photo of a user having a width of 100 pixels. If the user doesn’t have a photo, he returns http://vk.com/images/camera_b.gif. |
12. photo_200_orig |
url of a user photo that has a width of 200 pixels. If the user doesn’t have a photo, he returns http://vk.com/images/camera_a.gif. |
13. has_mobile |
information about whether the user's mobile phone number is known. Return values: 1 - known, 0 - unknown. |
14. online |
information about whether the user is currently online. |
15. can_post |
information about whether the current user can post on the wall. Possible values: 1 - can, 0 - can not. |
16. can_see_all_posts |
information about whether the current user can see someone else's posts on the wall. Possible values: 1 - can, 0 - can not. |
17. can_write_private_message |
information about whether the current user can send a private message. Possible values: 1 - can, 0 - can not. |
18. status |
user status. Returns a string containing the text of the status located in the profile under the user name. |
19. last_seen_time |
date and time of last visit. |
20. last_seen_platform |
the type of platform through which the last entry was made. Possible values: 1 - mobile version, 2 - application for iPhone, 3 - application for iPad, 4 - application for Android, 5 - application for Windows Phone, 6 - application for Windows 10, 7 - full version of the site. |
21. university |
university id. |
22. university_name |
university name. |
23. faculty |
faculty id. |
24. faculty_name |
faculty name. |
25. graduation |
graduation year. |
26. education_form |
learning form |
27. education_status |
status (for example, "Graduate (Specialist)") |
28. relation |
marital status of the user. Possible values: 1 - not married / not married, 2 - have a friend / have a girlfriend, 3 - engaged / engaged, 4 - married / married, 5 - everything is difficult, 6 - in active search, 7 - in love / in love, 8 - in a civil marriage, 0 - not specified. |
Author(s)
Alexey Seleznev
References
Documentation for API method friends.get: https://vk.com/dev/friends.get
Examples
## Not run:
## user list
my_vk_friends <- vkGetUserFriends(user_id = 7437995)
## End(Not run)
List of 'Vkontakte' communities.
Description
Returns the list of communities for the specified user.
Usage
vkGetUserGroups(
user_id = NULL,
filter = NULL,
username = getOption("rvkstat.username"),
api_version = getOption("rvkstat.api_version"),
token_path = vkTokenPath(),
access_token = getOption("rvkstat.access_token")
)
Arguments
user_id |
user ID for which you want to get a list of friends. If the parameter is not specified, it is considered that it is equal to the identifier of the current user. |
filter |
A list of community filters to be returned, separated by commas. The values are admin, editor, moder, groups, publics, events. By default, all user communities are returned. If the admin filter is specified, the communities in which the user is an administrator, editor - administrator or editor, moder - administrator, editor or moderator will be returned. |
username |
Your vkontakte login. |
api_version |
Vkontakte API version. |
token_path |
Path to dir with credentials |
access_token |
API access tokens obtained using vkAuth or vkGetToken functions |
Value
Date frame with community statistics with the following values:
gid |
community id. |
name |
community name. |
screen_name |
short address, for example, apiclub. |
is_closed |
is the community closed. Possible values: 0 - open, 1 - closed, 2 - private |
type |
community type: group - group, page - public page, event - event. |
description |
community description text. |
wiki_page |
name of the main wiki page. |
members_count |
number of members. |
start_date |
date of foundation. |
can_post |
information about whether the current user can post on the community wall. Possible values: 1 - can, 0 - can not. |
can_see_all_posts |
information about whether it is allowed to see other people's posts on the group wall. Possible values: 1 - can, 0 - can not. |
activity |
public page status bar. For groups, a string value is returned, whether the group is open or not, and for events the start date. |
status |
community status. |
fixed_post |
pinned post ID. |
verified |
information about whether the community is verified. Possible values: 1 - can, 0 - can not. |
site |
the address of the site from the "web site" field in the community description. |
can_create_topic |
information on whether the current user can create a new discussion in the group. Possible values: 1 - can, 0 - can not. |
photo |
URL of the main photo with a size of 50x50px. |
photo_medium |
URL of the main photo with a size of 100x100px. |
photo_big |
The URL of the main photo in the maximum size. |
Author(s)
Alexey Seleznev
References
Documentation for API method groups.get: https://vk.com/dev/groups.get
Examples
## Not run:
## auth
my_tok <- vkAuth(app_id = 1, app_secret = "H2Pk8htyFD8024mZaPHm")
## get groups
my_vk_community <- vkGetUserGroups(user_id = 7437995,
access_token = my_tok$access_token)
## End(Not run)
Get Posts From Userwall.
Description
Return posts list from userwall 'Vkontakte'.
Usage
vkGetUserWall(
user_id = NULL,
domain = NULL,
filter = NULL,
username = getOption("rvkstat.username"),
api_version = getOption("rvkstat.api_version"),
token_path = vkTokenPath(),
access_token = getOption("rvkstat.access_token")
)
Arguments
user_id |
user ID for which you want to get a list of friends. If the parameter is not specified, it is considered that it is equal to the identifier of the current user. |
domain |
short address of user or community. |
filter |
determines what types of posts on the wall should be received. Possible values: suggests — suggested entries on the community wall, postponed — deferred entries, owner — owner wall entries, others — not wall owner entries, all — all entries on the wall (owner + others), Default: all. |
username |
Your vkontakte login. |
api_version |
Vkontakte API version. |
token_path |
Path to dir with credentials |
access_token |
API access tokens obtained using vkAuth or vkGetToken functions |
Value
Date frame with the following values:
1. id |
record ID. |
2. from_id |
identifier of the post author. |
3. to_id |
identifier of the owner of the wall on which the entry is placed. |
4. date |
post publication time |
5. post_type |
record type, can be one of the following values: post, copy, reply, postpone, suggest. |
6. text |
text entry. |
7. can_delete |
information about whether the current user can delete a post (1 — maybe, 0 — cannot). |
8. comments_count |
number of comments. |
9. likes_count |
the number of users who liked the post. |
10. reposts_count |
number of users who copied the record. |
11. attachment_type |
type of media attachment of the record (photos, links, etc.) |
Author(s)
Alexey Seleznev
References
Documentation for API method wall.get: https://vk.com/dev/wall.get
Examples
## Not run:
## auth
my_tok <- vkAuth(app_id = 1, app_secret = "H2Pk8htyFD8024mZaPHm")
## get posts
my_vk_wall <- vkGetUserWall(user_id = 7437995,
access_token = my_tok$access_token)
## End(Not run)
Load vkontakte developer token
Description
vkLoadToken load your developer token, which you need for work with vk.com api
Usage
vkLoadToken()
Value
R object with vk.com token
Author(s)
Alexey Seleznev
Examples
## Not run:
##---- Get token from work directory
myToken <- vkLoadToken()
## End(Not run)
Set rvkstat options
Description
Helper function for settings options: username, account_id, agency_id, access_token, token_path and console log level
Usage
vkSetUsername(username)
vkSetAccountId(account_id)
vkSetAgencyId(agency_id)
vkSetAccessToken(access_token)
vkSetTokenPath(token_path)
vkSetThreshold(
level = c("info", "fatal",
"error", "warn",
"debug", "trace")
)
Arguments
username |
Your vkontakte login. |
account_id |
Ads account Id. |
agency_id |
Agency account Id. |
token_path |
Path to dir with credentials |
access_token |
API access tokens obtained using vkAuth or vkGetToken functions |
level |
Console log information level, one of: "info", "fatal", "error", "warn", "debug", "trace" |
Author(s)
Alexey Seleznev