Learn R Programming

rvkstat (version 3.2.0)

vkGetAdGenderStats: 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.

References

Documentation for API method ads.getStatistics: https://vk.com/dev/ads.getStatistics

Examples

Run this code
# 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")

# }

Run the code above in your browser using DataLab