Connect to the CJA API, which powers CJA Workspace. The package was developed with the analyst in mind and will continue to be developed with the guiding principles of iterative, repeatable, timely analysis. New features are actively being developed and we value your feedback and contribution to the process. Please submit bugs, questions, and enhancement requests as issues in this Github repository.
# Install from CRAN
install.packages('cjar')
# Load the package
library(cjar)
# Install devtools from CRAN
install.packages("devtools")
# Install adobeanayticsr from github
devtools::install_github('benrwoodard/cjar')
# Load the package
library(cjar)
A note about JWT Authentication: Service Account (JWT) credentials have been deprecated in favor of the OAuth Server-to-Server credentials. Your projects using the Service Account (JWT) credentials will stop working after June 30, 2025. See Adobe’s documentation for more information.
There are four setup steps required to start accessing your Customer Journey Analytics data using Server-to-Server (S2S) OAuth. The following steps are each outlined in greater detail in the following sections:
.Renviron
filecja_auth()
.cja_get_dataviews()
.When using S2S authentication, you need an Adobe Console API project for each organization you are needing to access.
Once you are a developer for a CJA product profile, you can create an API client in the Adobe Developer Console.
.json
file. Reference ?cja_auth
for more information on
the variables needed. Using the preconfigured JSON file is the
easiest method.This file is essential to keeping your information secure. It also speeds up analysis by limiting the number of arguments you need to add to every function call.
.Renviron
file (if you have never heard of
this file you almost certainly don’t have one!), then create a new
file and save it with the name .Renviron
. You can do this from
within the RStudio environment and save the file either in your
Home
directory (which is recommended; click on the Home button
in the file navigator in RStudio and save it to that location) or
within your project’s working directory. You can also use the
“usethis” package
to create the file by running the function
edit_r_environ(scope = "user")
.Renviron
file using the
file location path of the JSON file. The format of variables in the
.Renviron
file is straightforward.## S2S creds ##
CJA_AUTH_FILE=filelocation.json
After adding this variable to the .Renviron
file and saving it,
restart your R session (Session > Restart R in RStudio) and reload
the package (library(cjar)
).
The token is actually a lonnnnng alphanumeric string that is the what ultimately enables you to access your data:
cja_auth()
and press Enter.note: If you get the following response it is due to not having the Experience Platform API added to the project.
"error_code": "403027",
"message": "User region is missing"
All data in CJA is located in Data Views, similar to Report Suites in Adobe Analytics. Before pulling data it is essential to locate the data view id you are attempting to pull from.
#Pull a list of available data views
dv <- cja_get_dataviews(expansion = c('name', 'description'))
#note: see function documentation for all availabe expansion metadata available.
Once you have the data view ID you want then you can begin pulling data using the different functions.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.