Pipe Adobe Analytics Data to CSV in PowerShell

Ready to get started?

Download for a free trial:

Download Now

Learn more:

Adobe Analytics Cmdlets

An easy-to-use set of PowerShell Cmdlets offering real-time access to Adobe Analytics data. The Cmdlets allow users to access live Adobe Analytics Metrics, Users, Reports, Segments, etc. - just like working with SQL server.

Use standard PowerShell cmdlets to access Adobe Analytics tables.

The CData Cmdlets Module for Adobe Analytics is a standard PowerShell module offering straightforward integration with Adobe Analytics. Below, you will find examples of using our AdobeAnalytics Cmdlets with native PowerShell cmdlets.

Creating a Connection to Your Adobe Analytics Data

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.

$conn = Connect-AdobeAnalytics  -GlobalCompanyId "$GlobalCompanyId" -RSID "$RSID" -OAuthClientId "$OAuthClientId" -OauthClientSecret "$OauthClientSecret" -CallbackURL "$CallbackURL"

Selecting Data

Follow the steps below to retrieve data from the AdsReport table and pipe the result into to a CSV file:

Select-AdobeAnalytics -Connection $conn -Table AdsReport | Select -Property * -ExcludeProperty Connection,Table,Columns | Export-Csv -Path c:\myAdsReportData.csv -NoTypeInformation

You will notice that we piped the results from Select-AdobeAnalytics into a Select-Object cmdlet and excluded some properties before piping them into an Export-Csv cmdlet. We do this because the CData Cmdlets append Connection, Table, and Columns information onto each "row" in the result set, and we do not necessarily want that information in our CSV file.

The Connection, Table, and Columns are appended to the results in order to facilitate piping results from one of the CData Cmdlets directly into another one.