- OurPcGeek
- Posts
- How to Connect Adobe Analytics to RStudio Using Web Services API and RSiteCatalyst
How to Connect Adobe Analytics to RStudio Using Web Services API and RSiteCatalyst
Unlock the Power of Adobe Analytics in RStudio: A Step-by-Step Guide to Integrating Data with RSiteCatalyst and Web Services API
If you’re looking to connect Adobe Analytics with RStudio, the Web Services API offers a programmatic way to access Adobe’s powerful analytics data, opening up endless possibilities for analysis and customization beyond what’s available in the Analytics interface. In this guide, we’ll walk you through how to set up and authenticate the RSiteCatalyst package for seamless Adobe Analytics integration.
Getting Started: Setting Up the Web Services API for Adobe Analytics
Before diving into the RStudio setup, ensure you have Web Services API enabled in Adobe Analytics. You can find this under:
Analytics > Admin > Company Settings > Web Services
With the API enabled, you can use RStudio and the RSiteCatalyst package to interact with Adobe Analytics directly.
What is RSiteCatalyst?
RSiteCatalyst is an open-source R package designed for interacting with Adobe Analytics. It allows users to query and retrieve data through the Adobe Analytics API, empowering analysts to streamline workflows in R and avoid manual data pulls.
Authenticating Adobe Analytics with RSiteCatalyst
To begin, load the RSiteCatalyst library in R:
library("RSiteCatalyst")
Next, use the SCAuth()
function to store your Adobe Analytics credentials securely. This step requires a few key details:
Client ID and Secret from Adobe Marketing Cloud (found in your Dev Center).
Company Name (if using OAuth2).
Optional Token File path for storing authentication details across sessions.
SCAuth Function Details
Here’s how SCAuth()
works:
SCAuth(key, secret, company = "", token.file = "", auth.method = "legacy", debug.mode = FALSE, endpoint = "", locale = "en_US")
key: Your Client ID or legacy API username.
secret: API shared secret.
company: Your company name, needed if using OAuth2.
token.file: (Optional) Path for saving tokens across sessions.
auth.method: Defaults to 'legacy'; use 'OAUTH2' for OAuth.
debug.mode: Set to
TRUE
for debug logs.endpoint: Custom API endpoint.
locale: Report encoding, default is
"en_US"
.
Example Authentication Code
To authenticate, replace placeholders with your credentials:
SCAuth("your_company:username", "your_secret_key")
Note: Be sure to use your own credentials, not the sample provided here.
Running Adobe Analytics Reports with RSiteCatalyst
After authenticating, you’re ready to pull data. Here’s a sample script to request a trended report:
# Define date range
datefrom <- Sys.Date() - 91
dateto <- Sys.Date() - 1
# Queue the trended report
trended_id <- QueueTrended("productionreportsuite",
datefrom,
dateto,
metrics = "visits",
elements = c("evar10", "mobiledevicetype"),
segment.id = c("s300000988_5be8bc302b36874afe33502f", "s300000899_5bedfc3e706e9e558c910e1a"),
date.granularity = "day",
interval.seconds = 300,
top = 30000,
expedite = TRUE,
enqueueOnly = TRUE)
# Retrieve the report
trended <- GetReport(trended_id, interval.seconds = 5, max.attempts = 5)
Additional Resources
RSiteCatalyst is a community-driven project, and as such, improvements and bug fixes rely on contributions from users. You can find additional support and resources at the RSiteCatalyst documentation and Adobe Analytics documentation for locales and API configurations.
Conclusion
Using RSiteCatalyst with Adobe Analytics opens up powerful opportunities for in-depth data analysis. With these steps, you’re well on your way to unlocking advanced insights in R. Happy analyzing!
Reply