![]() |
VOOZH | about |
The CData Cmdlets for Adobe Analytics are standard PowerShell cmdlets that make it easy to accomplish data cleansing, normalization, backup, and other integration tasks by enabling real-time access to Adobe Analytics.
The Cmdlets are not only a PowerShell interface to Adobe Analytics, but also an SQL interface; this tutorial shows how to use both to retrieve Adobe Analytics data. We also show examples of the ADO.NET equivalent, which is possible with the CData ADO.NET Provider for Adobe Analytics. To access Adobe Analytics data from other .NET applications, like LINQPad, use the CData ADO.NET Provider for Adobe Analytics.
Once you have acquired the necessary connection properties, accessing Adobe Analytics data in PowerShell can be enabled in three steps.
Adobe Analytics uses the OAuth authentication standard. To authenticate using OAuth, create an app to obtain the OAuthClientId, OAuthClientSecret, and CallbackURL connection properties. See the "Getting Started" section of the help documentation for a guide.
GlobalCompanyId is a required connection property. If you do not know your Global Company ID, you can find it in the request URL for the users/me endpoint on the Swagger UI. After logging into the Swagger UI Url, expand the users endpoint and then click the GET users/me button. Click the Try it out and Execute buttons. Note your Global Company ID shown in the Request URL immediately preceding the users/me endpoint.
Report Suite ID (RSID) is also a required connection property. In the Adobe Analytics UI, navigate to Admin -> Report Suites and you will get a list of your report suites along with their identifiers next to the name.
After setting the GlobalCompanyId, RSID and OAuth connection properties, you are ready to connect to Adobe Analytics.
Install the module:
Install-Module AdobeAnalyticsCmdlets
Connect:
$adobeanalytics = Connect-AdobeAnalytics -GlobalCompanyId "$GlobalCompanyId" -RSID "$RSID" -OAuthClientId "$OAuthClientId" -OauthClientSecret "$OauthClientSecret" -CallbackURL "$CallbackURL"
Search for and retrieve data:
$city = "Chapel Hill" $adsreport = Select-AdobeAnalytics -Connection $adobeanalytics -Table "AdsReport" -Where "City = `'$City`'" $adsreport
You can also use the Invoke-AdobeAnalytics cmdlet to execute SQL commands:
$adsreport = Invoke-AdobeAnalytics -Connection $adobeanalytics -Query 'SELECT * FROM AdsReport WHERE City = @City' -Params @{'@City'='Chapel Hill'}
Load the provider's assembly:
[Reflection.Assembly]::LoadFile("C:\Program Files\CData\CData ADO.NET Provider for Adobe Analytics\lib\System.Data.CData.AdobeAnalytics.dll")
Connect to Adobe Analytics:
$conn= New-Object System.Data.CData.AdobeAnalytics.AdobeAnalyticsConnection("GlobalCompanyId=myGlobalCompanyId; RSID=myRSID; OAuthClientId=myOauthClientId; OauthClientSecret=myOAuthClientSecret; CallbackURL=myCallbackURL;")
$conn.Open()
Instantiate the AdobeAnalyticsDataAdapter, execute an SQL query, and output the results:
$sql="SELECT Page, PageViews from AdsReport"
$da= New-Object System.Data.CData.AdobeAnalytics.AdobeAnalyticsDataAdapter($sql, $conn)
$dt= New-Object System.Data.DataTable
$da.Fill($dt)
$dt.Rows | foreach {
Write-Host $_.page $_.pageviews
}
Download a free trial of the Adobe Analytics Data Provider to get started:
Download NowLearn more:
👁 Adobe Analytics IconRapidly create and deploy powerful .NET applications that integrate with Adobe Analytics data including Metrics, Users, Reports, Segments, and more!