Ready to get started?

Learn more about the CData ADO.NET Provider for Adobe Analytics or download a free trial:

Download Now

Automate Adobe Analytics Integration Tasks from PowerShell

Are you looking for a quick and easy way to access Adobe Analytics data from PowerShell? We show how to use the Cmdlets for Adobe Analytics and the CData ADO.NET Provider for Adobe Analytics to connect to Adobe Analytics data and synchronize, automate, download, and more.

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.

Cmdlets or ADO.NET?

The cmdlets are not only a PowerShell interface to the Adobe Analytics API, 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.

After obtaining the needed connection properties, accessing Adobe Analytics data in PowerShell consists of three basic steps.

Adobe Analytics uses the OAuth authentication standard. To authenticate using OAuth, you will need to create an app to obtain the OAuthClientId, OAuthClientSecret, and CallbackURL connection properties. See the "Getting Started" section of the help documentation for a guide.

Retrieving GlobalCompanyId

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.

Retrieving Report Suite Id

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.

PowerShell

  1. Install the module:

    Install-Module AdobeAnalyticsCmdlets
  2. Connect:

    $adobeanalytics = Connect-AdobeAnalytics -GlobalCompanyId "$GlobalCompanyId" -RSID "$RSID" -OAuthClientId "$OAuthClientId" -OauthClientSecret "$OauthClientSecret" -CallbackURL "$CallbackURL"
  3. 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'}

ADO.NET

  1. 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")
  2. Connect to Adobe Analytics:

    $conn= New-Object System.Data.CData.AdobeAnalytics.AdobeAnalyticsConnection("GlobalCompanyId=myGlobalCompanyId; RSID=myRSID; OAuthClientId=myOauthClientId; OauthClientSecret=myOAuthClientSecret; CallbackURL=myCallbackURL;") $conn.Open()
  3. 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 }