knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "README-"
)

FBadstats

R Package for generating statistics from Facebook ads performance data. Assists with ad targeting by aggregating data across multiple ad sets or campaigns in an attractive way. Works with many kinds of column selections from Facebook Ads Manager including Campaign, Ad Set, and Ad primary views. Currently only includes the breakdown Group analyzer function FBadGstats.
Disclaimer: This function and the entire FBadstats package are not supported or endorsed by Facebook, Inc. Only the user is responsible for its use.

Installation

First install the free (open-source) statistical software (and language) named "R" at: http://cran.rstudio.com/

Then download the most popular software to make using R easier, RStudio. The free version will be perfect. Scroll down and choose the appropriate installer under Installers for Supported Platforms at: https://www.rstudio.com/products/rstudio/download/

Open RStudio and you can now install the FBadstats package from github by entering the following in RStudio:

## This first package is to enable the install_github function
install.packages("devtools")
## Now we can always load that package with
library("devtools")
## Install FBadstats
devtools::install_github("RickPack/FBadstats")

Easiest use - select a file or folder

The easiest use is to call the function, navigate to your exported CSV file and then select it. The default parameters may give you all you need.

Call the function

## load the package
library(FBadstats)
FBadGstats()

Select your file

Windows Explorer file-selection

Use the output

Portion of FBadGstats output

You can select a folder and process all of the .CSV files with:

FBadGstats(choosedir=TRUE)

Advanced usage - modifying parameters

Advanced Example 1/3

## Load FBadstats
library("FBadstats")
# Show only the best performing groups and include the graphical output, 
# minimum spend to appear is a dollar ($1), analyzed result is Unique CTR (Link Click-Through Rate)
FBadGstats(filerd = "example_DMA.csv", grphout = TRUE, tblout = "BEST", 
           spentlim = 1, sumvar = 'LINK.CLICKS')

For A/B testing, use the filtervar and filtervarneg parameters.

Here we see BOTH [default for tblout parameter] the top 3 and worst 3 Age / Gender groups in a comparison between where "6txt" did (parameter filtervar = "hotreg") and did not (parameter filtervarneg = "hotreg") appear in the ad set name.
At least two events (clicks) must have occurred. Otherwise, an anomalous single event for 25-34 males caused that group to appear.
"Hotreg" indicated where selected regions with a history of performing well were the only ones targeted with the advertisement.

Advanced Example 2/3

FBadGstats(filerd = "example_PerfClk_AgeGender.csv", filtervar = 'hotreg',    printrow = 3, minevent = 2, grphout = FALSE)
FBadGstats(filerd = "example_PerfClk_AgeGender.csv", filtervarneg = 'hotreg', printrow = 3, minevent = 2,   grphout = FALSE)

Advanced Example 3/3 (Assign FBadGstats call to a variable in order to explore the data outside of FBadGstats)

A list is returned so use [[1]] for breakdown groups and [[2]] for Campaign, Ad, or Ad Set, one of which being automatically detected based on the inputfile
myfbfrm <- FBadGstats(filerd = "Example_AdsView_Region.csv", filtervar = 'Teach', grphout = FALSE)
## What are all of the available ad set names?
# 1. First look at the column names in the data
colnames(myfbfrm)
# 2. Now we can use the unique function to see all of the available names and appropriately adjust the filtervar parameter
unique(myfbfrm$AD.NAME)

Note: See more examples by entering in RStudio:

vignette(package = "FBadstats")

Acknowledgements

Thank you to Brian Fannin, Ari Lamstein, and Lucia Gjeltema for your feedback and encouragement.



RickPack/FBadstats documentation built on May 14, 2019, 6:13 p.m.