The steps below are a one-time setup, but they must be followed for the examples on this site to work.
Note: There are two different ways to authenticate with Adobe Analytics: 1) simply by getting (and using) your username and API secrect, and 2) using OAuth2. In theory, the former is going to be deprecated at some point, and it is somewhat less secure of a mechanism. But, that’s what we’re going to use. To use the OAuth approach see the details on the main dartistics.com site on the subject.
This is a file that loads when an R session gets initiated. There are various options for managing this exactly, but below describes an approach that is inarguably the BEST approach!*
Find your Home directory by clicking on the Home button in the Files pane of RStudio. Then, simply create a new text file (File > New File > Text File) and save it as .Renviron
. You might get a warning about how this will be a hidden file, but just ignore the warning. Live life on the edge!
The examples expect three variables to be in the ‘.Renviron’ file. You’re welcome to add other variables, and, over time, should have a quite robust file. But, we only need three. The file should look something like this:
ADOBE_API_USERNAME = "XXXXXX:XXXXXXXXXXXX""
ADOBE_API_SECRET = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
ADOBE_RSID = "XXXXXXXXXXXXX"
No, silly, you don’t want a bunch of Xs there! You will need to update those with values that are unique to your environment:
Now, save the file.
This happens any time you start a new R session, so you won’t have to worry about this going forward unless you change a value (like ADOBE_RSID
). For this one time, though, select Session > Restart R in RStudio.
Run the following code in your console:
username <- Sys.getenv("ADOBE_API_USERNAME")
Now, check the Environment pane in RStudio. You should see an object called username
with your Adobe Web Services User Name. You can run this for the other two values, too, but let’s just assume that, if it worked for one, you’re all set.
You should be all set! The examples should all work!
* Subjectively… but it’s what @HoloMarkeD does, and you can come up with your own special way at your own risk.
This site is a sub-site to dartistics.com