rmytarget (version 2.1.8)

myTarGetStats: Get stat by any 'MyTarget API' objects

Description

Load data frame with statistic by any API objects.

Usage

myTarGetStats(date_from   = Sys.Date() - 7,
           date_to     = Sys.Date(), 
           object_type = "campaigns",
           object_id   = NULL, 
           stat_type   = "day",
           metrics     = "base",
           auth        = NULL,
           token_path  = getwd(), 
           login       = NULL)

Arguments

date_from

Start date

date_to

End date

object_type

API object typr, character value, apply one of campaigns, banners, users

object_id

ID of API object (id campaign or any object

stat_type

Time stap, get value day or hour

metrics

Set of metrics, see metrics section for more ditali, default "base", but you can load any of all, base, events, video, viral, uniques, tps, or go this link

auth

R auth object

token_path

Path to directory where you save credential data

login

Your login, or client name in MyTarget account

Value

Data frame with statistic.

Sets of metrics

You can load different sets of metrics, for this use metrics arguments, and set a vector containing the names of the desired metric sets. For more details go this link. For example: metrics = c("base", "video", "viral")

base - based metrcis.

shows

Number of impressions

clicks

Number of clicks

goals

Number of goals achieved

spent

Cost sum

cpm

Average cost per 1000 views

cpc

Average cost per click

cpa

Average cost per goals

ctr

Percentage of clicks to views

cr

Percentage ratio of the number of goals achieved to the number of clicks.

events - metrics for advertised posts on social media feeds.

opening_app

Number of discoveries of the advertised social networks application

opening_post

Number of discoveries of the advertised message in the social media feed

moving_into_group

Number of transitions to the group page from the advertised message

clicks_on_external_url

Number of clicks on the external link in the advertised message

launching_video

Number of video launches in advertised message

comments

Number of comments left in the advertised message

joinings

Number of joining the group through the advertised message

likes

Number of likes of the advertised message

shares

Number of action "Share" for the advertised message.

votings

Number of voting actions in the advertised message

uniques - metrics by the number of unique users.

reach

Number of unique users who saw the ad for the specified period

total

Number of unique users who saw an ad for all time

increment

Number of new unique users who saw the ad for the specified period

frequency

Average frequency of displaying ads to one unique user

video - metrics for video ads.

started

Number of video playback starts

paused

Number of pauses of video playback

resumed_after_pause

Number of video playback after pause

fullscreen_on

Number of full-screen video playbacks

fullscreen_off

Number of shutdowns of full-screen video playback

sound_turned_off

Number of video mute

sound_turned_on

Number of video sound starts

viewed_10_seconds

Number of views of the first 10 seconds of the video

viewed_25_percent

Number of views of the first 25 percent of the video duration

viewed_50_percent

Number of views of the first 50 percent of the video duration

viewed_75_percent

Number of views of the first 75 of the video duration

viewed_100_percent

Number of views 100 percent of the video duration

viewed_10_seconds_rate

Percentage of views with the achievement of the first 10 seconds of the video

viewed_25_percent_rate

Percentage of views with the achievement of the first 25 percent of the video duration

viewed_50_percent_rate

Percentage of views with the achievement of the first 50 percent of the video duration

viewed_75_percent_rate

Percentage of views with the achievement of the first 75 percent of the video duration

viewed_100_percent_rate

Percentage of views with the achievement of the first 100 percent of the video duration

depth_of_view

Average video viewing depth (percent)

view_10_seconds_cost

Average cost of watching the first 10 seconds of a video

viewed_25_percent_cost

Average viewing cost of the first 25 percent of video length

viewed_50_percent_cost

Average viewing cost of the first 50 percent of video length

viewed_75_percent_cost

Average viewing cost of the first 75 percent of video length

viewed_100_percent_cost

Average viewing cost of the first 100 percent of video length

viral - metrics of viral events.

viral_impressions

Number of impressions of the shared advertising message in social networks

viral_reach

Number of unique users who saw the shared advertising message for the specified period

viral_total

Total number of unique users who have seen the shared advertising message for all time

viral_increment

Number of new unique users who saw the shared advertising message for the specified period

viral_frequency

Average frequency of displaying a shared advertising message to one unique user

viral_opening_app

Number of openings of the advertised application from the shared advertising message

viral_opening_post

Number of discoveries of the shared advertised message in the social media feed

viral_moving_into_group

number of transitions to the group page from the shared advertised message

viral_clicks_on_external_url

Number of clicks on the external link in the shared advertised message

viral_launching_video

Number of video launches in the shared advertised message

viral_comments

Number of comments left in the shared advertised message

viral_joinings

Number of joining the group through the shared advertised message

viral_likes

Number of likes of the shared advertised message

viral_shares

Number of actions "Share" for the shared advertised message

viral_votings

Number of voting actions in the shared advertised message

carousel - statistics on individual slides of the advertising carousel (N - from 1 to the number of slides).

slide_N_shows

Number of N slide shows

slide_N_clicks

Number of clicks on slide N

slide_N_ctr

Percentage ratio of clicks to the number of views on slide N

tps - additional write-off statistics.

tps

Additional charges for using the moat service

tpd

Additional charges for using third-party data (from dmp).

moat - statistics according to the moat service.

impressions

Number of impressions

in_view

Number of visible shows

never_focused

Number of impressions in the inactive tab

never_visible

Number of impressions out of sight

never_50_perc_visible

Additional charges for using third-party data (from dmp).

never_1_sec_visible

Number of impressions with visibility duration less than 1 second

human_impressions

Number of verified impressions

impressions_analyzed

number of impressions analyzed

in_view_percent

Number of impressions analyzed

human_and_viewable_perc

Percentage of visible hits

never_focused_percent

Verified impression percentage

never_visible_percent

Impression percentage in inactive tab

never_50_perc_visible_percent

The percentage of orders with a zone of visibility of the ad is less than 50 percent

never_1_sec_visible_percent

Percentage of impressions with visibility duration less than 1 second

in_view_diff_percent

Visible impression difference

active_in_view_time

Average time the ad is in view

attention_quality

Engagement level

See Also

MyTarget API documentation - https://target.my.com/doc/api/detailed/#resource_statistics

Examples

Run this code
# NOT RUN {
# base metrics by campaigns
base_data <- myTarGetStats(date_from   = Sys.Date() - 7,
                           date_to     = Sys.Date(),
                           object_type = "campaigns",
                           metrics = "base",
                           stat_type = "day",
                           login = "client_login", 
                           token_path = "D:\mytarget_token")

# all metrics by campaigns
all_data <- myTarGetStats(date_from   = Sys.Date() - 7,
                          date_to     = Sys.Date(),
                          object_type = "campaigns",
                          metrics = "all",
                          stat_type = "day",
                          login = "client_login", 
                          token_path = "D:\mytarget_token")

# custom set of metric by campaigns
custom_data <- myTarGetStats(date_from   = Sys.Date() - 7,
                             date_to     = Sys.Date(),
                             object_type = "campaigns",
                             metrics = c("base", "tps", "viral"),
                             stat_type = "day",
                             login = "client_login", 
                             token_path = "D:\mytarget_token")


# if have note objects id, base metrics by ads
base_data2 <- myTarGetStats(date_from   = as.Date("2013-01-01"),
                            date_to     = Sys.Date(),
                            object_type = "banners",
                            metrics = "base",
                            stat_type = "day",
                            login = "client_login", 
                            token_path = "D:\mytarget_token")
							
# get all stats group by clients, only for agency account
client_stat <-  myTarGetStats(date_from   = Sys.Date() - 7,
                              date_to     = Sys.Date(),
                              object_type = "users",
                              metrics     = "all",
                              login       = "agency_login")
# }

Run the code above in your browser using DataCamp Workspace