@adobe/aio-lib-analytics
v4.0.1
Published
Adobe Analytics SDK
Downloads
29,038
Maintainers
Keywords
Readme
Adobe I/O Adobe Analytics SDK
Node Javascript Core SDK wrapping Adobe Analytics 2.0 APIs.
Installing
$ npm install
Usage
- Initialize the SDK
var sdk = require('@adobe/aio-lib-analytics');
async function sdkTest() {
//initialize sdk
const analyticsClient = await sdk.init('<companyID>', 'x-api-key', '<valid auth token>')
}
Init method returns an Instance of Class AnalyticsCoreAPI
- Call methods using initialized sdk
var sdk = require('@adobe/aio-lib-analytics');
async function sdkTest() {
//initialize sdk
const analyticsClient = await sdk.init('<companyID>', '<x-api-key>', '<valid auth token>')
//get report suites
const collections = await analyticsClient.getCollections({limit:5, page:0})
//get metrics
const metrics = await analyticsClient.getMetrics(rsid)
//generate report
const report = await analyticsClient.getReport(queryJSON)
}
All Methods available under sdk are documented here
Classes
Functions
AnalyticsCoreAPI
This class provides methods to call Adobe Analytics APIs. Before calling any method initialize the instance by calling init method on it with valid company id, apiKey and auth token
Kind: global class
- AnalyticsCoreAPI
- .init(companyId, apiKey, token) ⇒ AnalyticsCoreAPI
- .getCalculatedMetrics(options)
- .getCalculatedMetricById(id, options)
- .getCollections(options)
- .getCollectionById(rsid, options)
- .getDateRanges(options)
- .getDateRangeById(dateRangeId, options)
- .getDimensions(rsid, options)
- .getDimensionById(dimensionId, rsid, options)
- .getMetrics(rsid, options)
- .getMetricById(id, rsid, options)
- .getReport(body)
- .getSegments(options)
- .validateSegment(rsid, body)
- .getUsers(options)
- .getCurrentUser()
- .getUsageLogs(startDate, endDate, options)
analyticsCoreAPI.init(companyId, apiKey, token) ⇒ AnalyticsCoreAPI
Initialize sdk.
Kind: instance method of AnalyticsCoreAPI
| Param | Type | Description | | --- | --- | --- | | companyId | string | company ID to be used with Adobe Analytics. | | apiKey | string | Your api key | | token | string | Valid auth token |
analyticsCoreAPI.getCalculatedMetrics(options)
Retrieve many calculated metrics. A calculated metric response will always include these default items: id, name, description, rsid, owner, polarity, precision, type Other attributes can be optionally requested through the 'expansion' field:\n\n modified: Date that the metric was last modified (ISO 8601) definition: Calculated metric definition as JSON object compatibility: Products that the metric is compatible with reportSuiteName*: Also return the friendly Report Suite name for the RSID tags*: Gives all existing tags associated with the calculated metric
For more information about calculated metrics go here
Kind: instance method of AnalyticsCoreAPI
| Param | Type | Description | | --- | --- | --- | | options | Object | to control calculated metrics search. | | options.calculatedMetricFilter | | Filter list to only include calculated metrics in the specified list\n(comma-delimited list of IDs). | | options.expansion | | Comma-delimited list of additional metadata fields\nto include on response. | | options.limit | | Number of results per page. Default 10. | | options.locale | | Locale. | | options.name | | Filter list to only include calculated metrics that contains the Name. | | options.ownerId | | Filter list to only include calculated metrics owned by the\nspecified loginId. | | options.page | | Page number (base 0 - first page is "0"). Default 0. | | options.rsids | | Filter list to only include calculated metrics tied to specified\nRSID list (comma-delimited). | | options.tagNames | | Filter list to only include calculated metrics that contains one of\nthe tags. |
analyticsCoreAPI.getCalculatedMetricById(id, options)
Retrieve a single calculated metric by id. A calculated metric response will always include these default items: id, name, description, rsid, owner, polarity, precision, type Other attributes can be optionally requested through the 'expansion' field:\n\n modified: Date that the metric was last modified (ISO 8601) definition: Calculated metric definition as JSON object compatibility: Products that the metric is compatible with reportSuiteName*: Also return the friendly Report Suite name for the RSID tags*: Gives all existing tags associated with the calculated metric
For more information about calculated metrics go here
Kind: instance method of AnalyticsCoreAPI
| Param | Type | Description | | --- | --- | --- | | id | string | The calculated metric ID to retrieve. | | options | Object | to control calculated metric result | | options.expansion | | Comma-delimited list of additional metadata fields\nto include on response. | | options.locale | | Locale. |
analyticsCoreAPI.getCollections(options)
Retrieves report suites that match the given filters. Returns all report suite types in a single collection.
Kind: instance method of AnalyticsCoreAPI
| Param | Type | Description | | --- | --- | --- | | options | Object | to control report suites search. | | options.expansion | | Comma-delimited list of additional metadata fields to include on\nresponse. | | options.limit | | Number of results per page. Default 10. | | options.page | | Page number (base 0 - first page is "0"). Default 0. | | options.rsids | | Filter list to only include suites in this RSID list\n(comma-delimited). | | options.rsidContains | | Filter list to only include suites whose rsid contains rsidContains. |
analyticsCoreAPI.getCollectionById(rsid, options)
Retrieves report suite by id. Returns all report suite types in a single collection.
Kind: instance method of AnalyticsCoreAPI
| Param | Type | Description | | --- | --- | --- | | rsid | string | The rsid of the suite to return. | | options | Object | to control eport suites search. | | options.expansion | | Comma-delimited list of additional metadata fields to include on\nresponse. |
analyticsCoreAPI.getDateRanges(options)
Returns a list of dateranges for the user. This function allows users to store commonly used date ranges so that they\ncan be reused throughout the product.
Kind: instance method of AnalyticsCoreAPI
| Param | Type | Description | | --- | --- | --- | | options | Object | to control date range search. | | options.expansion | | Comma-delimited list of additional metadata fields to include on\nresponse. | | options.filterByIds | | Filter list to only include date ranges in the specified list\n(comma-delimited list of IDs). | | options.limit | | Number of results per page. Default 10. | | options.locale | | Locale. | | options.page | | Page number (base 0 - first page is "0"). Default 0. |
analyticsCoreAPI.getDateRangeById(dateRangeId, options)
Retrieves configuration for a DateRange..
Kind: instance method of AnalyticsCoreAPI
| Param | Type | Description | | --- | --- | --- | | dateRangeId | string | The DateRange id for which to retrieve information. | | options | Object | to control date range result. | | options.expansion | | Comma-delimited list of additional metadata fields to include on\nresponse. | | options.locale | | Locale. |
analyticsCoreAPI.getDimensions(rsid, options)
Returns a list of dimensions for a given report suite.
Kind: instance method of AnalyticsCoreAPI
| Param | Type | Description | | --- | --- | --- | | rsid | string | A Report Suite ID. | | options | Object | to control dimensions search. | | options.classifiable | | Only include classifiable dimensions. | | options.expansion | | Comma-delimited list of additional metadata fields\nto include on response. | | options.locale | | Locale. | | options.reportable | | Only include dimensions that are valid within a report. | | options.segmentable | | Only include dimensions that are valid within a segment. |
analyticsCoreAPI.getDimensionById(dimensionId, rsid, options)
Returns a dimension for the given report suite and dimension Id.
Kind: instance method of AnalyticsCoreAPI
| Param | Type | Description | | --- | --- | --- | | dimensionId | string | The dimension ID. For example a valid id is a value like 'evar1'. | | rsid | string | A Report Suite ID. | | options | Object | to control dimension result. | | options.expansion | | Comma-delimited list of additional metadata fields\nto include on response. | | options.locale | | Locale. |
analyticsCoreAPI.getMetrics(rsid, options)
Returns a list of metrics for the given report suite. This returns the metrics list primarily for the Analytics product. The platform identity API Returns a list of all possible metrics for the supported systems.
Kind: instance method of AnalyticsCoreAPI
| Param | Type | Description | | --- | --- | --- | | rsid | string | A Report Suite ID. | | options | Object | to control dimension result. | | options.expansion | | Comma-delimited list of additional metadata fields\nto include on response. | | options.locale | | Locale that system named metrics should be returned in. | | options.segmentable | | Filter the metrics by if they are valid in a segment. |
analyticsCoreAPI.getMetricById(id, rsid, options)
Returns a metric for the given report suite. This returns the metrics list primarily for the Analytics product. The platform identity API Returns a list of all possible metrics for the supported systems.
Kind: instance method of AnalyticsCoreAPI
| Param | Type | Description | | --- | --- | --- | | id | string | The id of the metric for which to retrieve info. Note ids are values\nlike pageviews, not metrics/pageviews. | | rsid | string | A Report Suite ID. | | options | Object | to control dimension result. | | options.expansion | | Comma-delimited list of additional metadata fields\nto include on response. | | options.locale | | Locale that system named metrics should be returned in. |
analyticsCoreAPI.getReport(body)
Runs a report for the request. See the Reporting User\nGuide for details.
Kind: instance method of AnalyticsCoreAPI
| Param | Type | Description | | --- | --- | --- | | body | Object | report query. |
analyticsCoreAPI.getSegments(options)
Retrieve All Segments.
Kind: instance method of AnalyticsCoreAPI
| Param | Type | Description | | --- | --- | --- | | options | Object | to control segments search. | | options.expansion | | Comma-delimited list of additional metadata fields\nto include on response. | | options.includeType | | Include additional segments not owned by user. The "all" option\ntakes precedence over "shared". | | options.limit | | Number of results per page. Default 10. | | options.locale | | Locale that system named metrics should be returned in. | | options.name | | Filter list to only include segments that contains the Name. | | options.page | | Page number (base 0 - first page is "0"). Default 0. | | options.rsids | | Filter list to only include segments tied to specified RSID list\n(comma-delimited). | | options.segmentFilter | | Filter list to only include segments in the specified list\n(comma-delimited list of IDs). | | options.tagNames | | Filter list to only include segments that contains one of the tags. |
analyticsCoreAPI.validateSegment(rsid, body)
Validate a Segment. Returns a segment validation for the segment contained in the post body of the report.
Kind: instance method of AnalyticsCoreAPI
| Param | Type | Description | | --- | --- | --- | | rsid | string | A Report Suite ID. | | body | Object | JSON Segment Definition. |
analyticsCoreAPI.getUsers(options)
Returns a list of users for the current user's login company. Retrieves a list of all users for the company designated by the auth\ntoken.
Kind: instance method of AnalyticsCoreAPI
| Param | Type | Description | | --- | --- | --- | | options | Object | to control user search. | | options.limit | | Number of results per page. Default 10. | | options.page | | Page number (base 0 - first page is "0"). Default 0. |
analyticsCoreAPI.getCurrentUser()
Get the current user.
Kind: instance method of AnalyticsCoreAPI
analyticsCoreAPI.getUsageLogs(startDate, endDate, options)
Retrieves usage and access logs for the search criteria provided. This API returns the usage and access logs for a given date range within a 3 month period. This API authenticates with an IMS user token.
Kind: instance method of AnalyticsCoreAPI
| Param | Type | Description | | --- | --- | --- | | startDate | string | Start date in ISO-8601 format for the maximum of a 3 month period. | | endDate | string | End date in ISO-8601 format for the maximum of a 3 month period. | | options | Object | options to filter logs. | | options.login | string | The login value of the user you want to filter logs by. | | options.ip | string | The IP address you want to filter logs by. | | options.rsid | string | The report suite ID you want to filter logs by. | | options.eventType | string | The numeric id for the event type you want to filter logs by. | | options.event | string | The event description you want to filter logs by. No wildcards permitted. | | options.limit | number | Number of results per page. Default 10. | | options.page | number | Page number (base 0 - first page is "0"). Default 0. |
init(companyId, apiKey, token) ⇒ Promise.<AnalyticsCoreAPI>
Returns a Promise that resolves with a new AnalyticsCoreAPI object.
Kind: global function
| Param | Type | Description | | --- | --- | --- | | companyId | string | company ID to be used with Adobe Analytics. | | apiKey | string | Your api key | | token | string | Valid auth token |
Debug Logs
LOG_LEVEL=debug <your_call_here>
Contributing
Contributions are welcome! Read the Contributing Guide for more information.
Licensing
This project is licensed under the Apache V2 License. See LICENSE for more information.