4.0.1 • Published 3 months ago

@adobe/aio-lib-analytics v4.0.1

Weekly downloads
214
License
-
Repository
-
Last release
3 months ago

Version Downloads/week Node.js CI License Codecov Coverage

Adobe I/O Adobe Analytics SDK

Node Javascript Core SDK wrapping Adobe Analytics 2.0 APIs.

Installing

$ npm install

Usage

1) 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

2) 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

Initialize sdk.

Kind: instance method of AnalyticsCoreAPI

ParamTypeDescription
companyIdstringcompany ID to be used with Adobe Analytics.
apiKeystringYour api key
tokenstringValid 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

ParamTypeDescription
optionsObjectto control calculated metrics search.
options.calculatedMetricFilterFilter list to only include calculated metrics in the specified list\n(comma-delimited list of IDs).
options.expansionComma-delimited list of additional metadata fields\nto include on response.
options.limitNumber of results per page. Default 10.
options.localeLocale.
options.nameFilter list to only include calculated metrics that contains the Name.
options.ownerIdFilter list to only include calculated metrics owned by the\nspecified loginId.
options.pagePage number (base 0 - first page is \"0\"). Default 0.
options.rsidsFilter list to only include calculated metrics tied to specified\nRSID list (comma-delimited).
options.tagNamesFilter 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

ParamTypeDescription
idstringThe calculated metric ID to retrieve.
optionsObjectto control calculated metric result
options.expansionComma-delimited list of additional metadata fields\nto include on response.
options.localeLocale.

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

ParamTypeDescription
optionsObjectto control report suites search.
options.expansionComma-delimited list of additional metadata fields to include on\nresponse.
options.limitNumber of results per page. Default 10.
options.pagePage number (base 0 - first page is \"0\"). Default 0.
options.rsidsFilter list to only include suites in this RSID list\n(comma-delimited).
options.rsidContainsFilter 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

ParamTypeDescription
rsidstringThe rsid of the suite to return.
optionsObjectto control eport suites search.
options.expansionComma-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

ParamTypeDescription
optionsObjectto control date range search.
options.expansionComma-delimited list of additional metadata fields to include on\nresponse.
options.filterByIdsFilter list to only include date ranges in the specified list\n(comma-delimited list of IDs).
options.limitNumber of results per page. Default 10.
options.localeLocale.
options.pagePage number (base 0 - first page is \"0\"). Default 0.

analyticsCoreAPI.getDateRangeById(dateRangeId, options)

Retrieves configuration for a DateRange..

Kind: instance method of AnalyticsCoreAPI

ParamTypeDescription
dateRangeIdstringThe DateRange id for which to retrieve information.
optionsObjectto control date range result.
options.expansionComma-delimited list of additional metadata fields to include on\nresponse.
options.localeLocale.

analyticsCoreAPI.getDimensions(rsid, options)

Returns a list of dimensions for a given report suite.

Kind: instance method of AnalyticsCoreAPI

ParamTypeDescription
rsidstringA Report Suite ID.
optionsObjectto control dimensions search.
options.classifiableOnly include classifiable dimensions.
options.expansionComma-delimited list of additional metadata fields\nto include on response.
options.localeLocale.
options.reportableOnly include dimensions that are valid within a report.
options.segmentableOnly 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

ParamTypeDescription
dimensionIdstringThe dimension ID. For example a valid id is a value like 'evar1'.
rsidstringA Report Suite ID.
optionsObjectto control dimension result.
options.expansionComma-delimited list of additional metadata fields\nto include on response.
options.localeLocale.

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

ParamTypeDescription
rsidstringA Report Suite ID.
optionsObjectto control dimension result.
options.expansionComma-delimited list of additional metadata fields\nto include on response.
options.localeLocale that system named metrics should be returned in.
options.segmentableFilter 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

ParamTypeDescription
idstringThe id of the metric for which to retrieve info. Note ids are values\nlike pageviews, not metrics/pageviews.
rsidstringA Report Suite ID.
optionsObjectto control dimension result.
options.expansionComma-delimited list of additional metadata fields\nto include on response.
options.localeLocale 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

ParamTypeDescription
bodyObjectreport query.

analyticsCoreAPI.getSegments(options)

Retrieve All Segments.

Kind: instance method of AnalyticsCoreAPI

ParamTypeDescription
optionsObjectto control segments search.
options.expansionComma-delimited list of additional metadata fields\nto include on response.
options.includeTypeInclude additional segments not owned by user. The \"all\" option\ntakes precedence over \"shared\".
options.limitNumber of results per page. Default 10.
options.localeLocale that system named metrics should be returned in.
options.nameFilter list to only include segments that contains the Name.
options.pagePage number (base 0 - first page is \"0\"). Default 0.
options.rsidsFilter list to only include segments tied to specified RSID list\n(comma-delimited).
options.segmentFilterFilter list to only include segments in the specified list\n(comma-delimited list of IDs).
options.tagNamesFilter 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

ParamTypeDescription
rsidstringA Report Suite ID.
bodyObjectJSON 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

ParamTypeDescription
optionsObjectto control user search.
options.limitNumber of results per page. Default 10.
options.pagePage 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

ParamTypeDescription
startDatestringStart date in ISO-8601 format for the maximum of a 3 month period.
endDatestringEnd date in ISO-8601 format for the maximum of a 3 month period.
optionsObjectoptions to filter logs.
options.loginstringThe login value of the user you want to filter logs by.
options.ipstringThe IP address you want to filter logs by.
options.rsidstringThe report suite ID you want to filter logs by.
options.eventTypestringThe numeric id for the event type you want to filter logs by.
options.eventstringThe event description you want to filter logs by. No wildcards permitted.
options.limitnumberNumber of results per page. Default 10.
options.pagenumberPage 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

ParamTypeDescription
companyIdstringcompany ID to be used with Adobe Analytics.
apiKeystringYour api key
tokenstringValid 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.

4.0.1

3 months ago

4.0.0

4 months ago

3.0.1

10 months ago

3.0.0

2 years ago

2.1.1

3 years ago

2.1.0

3 years ago

2.0.1

3 years ago

2.0.0

4 years ago

1.0.2

4 years ago

1.0.1

5 years ago

1.0.0

5 years ago