Title: | R Client for 'Adobe Analytics' API 2.0 |
---|---|
Description: | Connect to the 'Adobe Analytics' API v2.0 <https://github.com/AdobeDocs/analytics-2.0-apis> which powers 'Analysis Workspace'. The package was developed with the analyst in mind, and it will continue to be developed with the guiding principles of iterative, repeatable, timely analysis. |
Authors: | Ben Woodard [aut, cre], Tim Wilson [aut, ctb], Charles Gallagher [ctb], Mark Edmondson [ctb] |
Maintainer: | Ben Woodard <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.4.0 |
Built: | 2024-12-15 15:22:16 UTC |
Source: | https://github.com/benrwoodard/adobeanalyticsr |
Get an anomaly report for one or more metrics
aw_anomaly_report( company_id = Sys.getenv("AW_COMPANY_ID"), rsid = Sys.getenv("AW_REPORTSUITE_ID"), date_range = c(Sys.Date() - 31, Sys.Date() - 1), metrics, granularity = "day", segmentId = NA, quickView = FALSE, anomalyDetection = TRUE, countRepeatInstances = TRUE, debug = FALSE )
aw_anomaly_report( company_id = Sys.getenv("AW_COMPANY_ID"), rsid = Sys.getenv("AW_REPORTSUITE_ID"), date_range = c(Sys.Date() - 31, Sys.Date() - 1), metrics, granularity = "day", segmentId = NA, quickView = FALSE, anomalyDetection = TRUE, countRepeatInstances = TRUE, debug = FALSE )
company_id |
Company Id. Taken from the global environment by default if not provided. |
rsid |
Adobe report number |
date_range |
A two length vector of start and end Date objects (default set to show last 30 days) |
metrics |
Metric to request the anomaly detection. If multiple metrics, each metric and date will have it's own row. |
granularity |
Use either hour, day (default), week, or month |
segmentId |
Use segments to globally filter the results. Use 1 or many. |
quickView |
Return a list of 3 lists per metric. 1. All Data 2. Data filtered to include only anomalous rows 3. Interactive ggplot line graph |
anomalyDetection |
logical statement for including anomaly. Default is TRUE |
countRepeatInstances |
Should the data include repeat instances |
debug |
default is FALSE but set to TRUE to see the json request being sent to the Adobe API |
If quickView = 'FALSE' (default) then a data frame including the day, metric, data, dataExpected, dataUpperBound, dataLowerBound, and dataAnomalyDetected will be returned. If quickView = 'TRUE' then a list of three lists will be returned. The first list will be a data frame including all the default columns. The second list item will be a filtered data frame that includes rows where dataAnomalyDetected = 'TRUE'. The third list item is a visual made using 'ggplot2' with the error band and points where the dataAnomalyDetected = 'TRUE'. If more than one metric is in the request and quickView is set to TRUE then the lists will be split by each metric requested.
Note: aw_auth()
is the primary function used for authorization. auth_oauth()
and auth_jwt()
should typically not be called directly.
aw_auth(type = aw_auth_with(), ...) auth_jwt( file = Sys.getenv("AW_AUTH_FILE"), private_key = Sys.getenv("AW_PRIVATE_KEY"), jwt_token = NULL, ... ) auth_oauth( client_id = Sys.getenv("AW_CLIENT_ID"), client_secret = Sys.getenv("AW_CLIENT_SECRET"), use_oob = TRUE )
aw_auth(type = aw_auth_with(), ...) auth_jwt( file = Sys.getenv("AW_AUTH_FILE"), private_key = Sys.getenv("AW_PRIVATE_KEY"), jwt_token = NULL, ... ) auth_oauth( client_id = Sys.getenv("AW_CLIENT_ID"), client_secret = Sys.getenv("AW_CLIENT_SECRET"), use_oob = TRUE )
type |
Either 'jwt' or 'oauth'. This can be set explicitly, but a best practice is
to run |
... |
Additional arguments passed to auth functions. |
file |
A JSON file containing service account credentials required for JWT
authentication. This file can be downloaded directly from the Adobe Console,
and should minimally have the fields |
private_key |
Filename of the private key for JWT authentication. |
jwt_token |
(Optional) A custom, encoded, signed JWT claim. If used,
|
client_id |
The client ID, defined by a global variable or manually defined |
client_secret |
The client secret, defined by a global variable or manually defined |
use_oob |
if |
The path of the cached token. This is returned invisibly.
auth_jwt()
: Authenticate with JWT token
auth_oauth()
: Authorize via OAuth 2.0
Get or set various authorization options. If called without an argument, then
these functions return the current setting for the requested option (which can be
NULL
if the option has not been set). To clear the setting, pass NULL
as an
argument.
aw_auth_with
sets the type of authorization for the session. This is used
as the default by aw_auth()
when no specific option is given.
aw_auth_path
sets the file path for the cached authorization token. It
should be a directory, rather than a filename. If this option is not set, the
current working directory is used instead.
aw_auth_name
sets the file name for the cached authorization token. If this
option is not set, the default filename is aw_auth.rds
aw_auth_with(type) aw_auth_path(path) aw_auth_name(name)
aw_auth_with(type) aw_auth_path(path) aw_auth_name(name)
type |
The authorization type: 'oauth' or 'jwt' |
path |
The location for the cached authorization token. It should be a directory, rather than a filename. If this option is not set, the current working directory is used instead. If the location does not exist, it will be created the first time a token is cached. |
name |
The filename, such as |
The option value, invisibly
Get a report analogous to a Freeform Table visualization in Analysis Workspace. The function uses the arguments to construct and execute a JSON-based query to the Adobe Analytics API and then returns the results as a data frame.
aw_freeform_table( company_id = Sys.getenv("AW_COMPANY_ID"), rsid = Sys.getenv("AW_REPORTSUITE_ID"), date_range = c(Sys.Date() - 30, Sys.Date() - 1), dimensions = c("page", "lasttouchchannel", "mobiledevicetype"), metrics = c("visits", "visitors"), top = c(5), page = 0, filterType = "breakdown", segmentId = NA, metricSort = "desc", include_unspecified = TRUE, search = NA, prettynames = FALSE, debug = FALSE, check_components = TRUE )
aw_freeform_table( company_id = Sys.getenv("AW_COMPANY_ID"), rsid = Sys.getenv("AW_REPORTSUITE_ID"), date_range = c(Sys.Date() - 30, Sys.Date() - 1), dimensions = c("page", "lasttouchchannel", "mobiledevicetype"), metrics = c("visits", "visitors"), top = c(5), page = 0, filterType = "breakdown", segmentId = NA, metricSort = "desc", include_unspecified = TRUE, search = NA, prettynames = FALSE, debug = FALSE, check_components = TRUE )
company_id |
Company ID. If an environment variable called |
rsid |
Adobe report suite ID (RSID). If an environment variable called |
date_range |
A length-2 vector with a start date and an end date.
|
dimensions |
A character vector of dimensions. There is currently a limit of 20 dimension
breakdowns. Each dimension value that gets broken down by another dimension requires an additional API
call, so the more dimensions that are included, the longer the function will take to return results.
This is how the Adobe Analytics API works. Use |
metrics |
A character vector of metrics. Use |
top |
The number of values to be pulled for each dimension. The default is 5 and the "top" is based on
the first |
page |
Used in combination with |
filterType |
This is a placeholder argument for use as additional functionality is added to the package.
Currently, it defaults to |
segmentId |
A single segment ID or a vector of multiple segment IDs to apply to the overall report.
If multiple |
metricSort |
Pre-sorts the table by metrics. Values are either |
include_unspecified |
Whether or not to include Unspecified values in the results. This is the equivalent
of the Include Unspecified (None) checkbox in freeform tables in Analysis Workspace. This defaults to |
search |
Criteria to filter the results by one or more dimensions. Searches are case-insenstive. Refer to the Details for more information on constructing values for this argument. |
prettynames |
A logical that determines whether the column names in the results use the API field name
(e.g., "mobiledevicetype", "pageviews") or the "pretty name" for the field (e.g., "Mobile Device Type",
"Page Views"). This applies to both dimensions and metrics. The default value is |
debug |
Set to |
check_components |
Specifies whether to check the validity of metrics and
dimensions before running the query. This defaults to |
This function is based on the Freeform Table visualization in Analysis Workspace. It is accessing the same API call type that is used to generate those visualizations.
Adobe Analytics only queries one dimension at a time, even though the results get returned in a single data frame (or table in the case of Analysis Workspace). The more dimensions are included in the report–the more breakdowns of the data–the more queries are required. As a result, the order of the dimensions can have a dramatic impact on the total query time, even if the resulting data is essentially identical.
One way to understand this is to consider how much dragging and dropping would be required to return the data in Analysis Workspace.
Consider a scenario where you are pulling metrics for the last 30 days (daterangeday
) for Mobile Device Type
(mobiledevicetype
), which has 7 unique values. Setting dimensions = c("daterangeday", "mobiledevicetype")
would make one query to get the values of the 30 days included. The query would then run a separate query
for each of those 30 days to get the mobiledevicetype
results for each day. So, this would be 31 API calls.
If, instead, the function was called with the dimension
values reversed (dimensions = c("mobiledevicetype", "daterangeday")
), then
the first query would return the 7 mobiledevicetype
values, and then would run an additional query for each of
those 7 mobile device type values to return the results for the 30 days within each device type. This would be only 7 API calls.
Strategically ordering dimensions–and then wrangling the resulting data set as needed–is one of the best ways to improve query performance.
Date handling has several special characteristics that are worth getting familiar with:
The API names for day, week, month, etc. are prepended with daterange
, so daily data uses
daterangeday
, weekly data uses daterangeweek
, monthly data uses daterangemonth
, etc.
When setting the argument for top
, if the first (or only) dimension
value is a daterange...
object,
then, if this argument is not explicitly specified or if it uses only a single value (e.g., top = 10
),
the function will still return all of the values that fall in that date range. For instance, if the
date_range
was set for a 30-day period and the first dimension
value was daterangeday
, and no value
is specified for top
, rather than simply returning the first 5 dates in the range, all 30 days will be
returned. In the same scenario, if top = 10
was set, then all 30 days would still be returned, and the
10
would simply be applied to the additional dimensions.
If you want to return all of the date/time values but then have specific control over the number of
values returned for each of the drilldown dimensions, then set 0
as the first value in the top
argument and then specify different numbers for each breakdown (e.g., top = c(0, 3, 10)
would return
all of the date/time values for the specified date_range
, the top 3 values for the second specified
dimension
, and then the top 10 values for each of the next dimension's results).
If you are using a daterange...
value not as the first dimension, then simply using 0
at the
same level in the top
argument specification will return all of the values for that date/time value.
There are powerful filtering abilities within the function. However, to support that power requires a syntax that can feel a bit cumbersome for simple queries. Note: search filters are case-insensitive. This is Adobe Analytics API functionality and can not be specified otherwise in queries.
The search
argument takes a vector of search strings, with each value in the vector corresponding to
the dimension
value that is at the same position. These search strings support a range of operators,
including AND
, OR
, NOT
, MATCH
, CONTAINS
, BEGINS-WITH
, and ENDS-WITH
.
The default for any search string is to use CONTAINS
. Consider a query where
dimensions = c("mobiledevicetype", "lasttouchchannel")
:
search = "CONTAINS 'mobile'"
will return results where mobiledevicetype
contains "mobile", so would return all rows for Mobile Phone.
This could be shortened to search = "'mobile'"
and would behave exactly the same, since CONTAINS
is the default operator
search = c("CONTAINS 'mobile'", "CONTAINS 'search'")
will return results where mobiledevicetype
contains "mobile" and, within those results, results where lasttouchchannel
contains "search".
search = c("(CONTAINS 'mobile') OR (CONTAINS 'tablet')", "(MATCH 'paid search')")
will return results where mobiledevicetype
contains "mobile" or "tablet" and, within those results, will only include results where lasttouchchannel
exactly matches "paid search" (but is case-insensitive, so would return "Paid Search" values).
A data frame with the specified dimensions and metrics.
get_me()
, aw_get_reportsuites()
, aw_get_segments()
,
aw_get_dimensions()
, aw_get_metrics()
, aw_get_calculatedmetrics()
,
aw_segment_table()
Retrieve a list of available calculated metrics. The results will always include these default items:
id
, name
, description
, rsid
, owner
, polarity
, precision
, type
. Other attributes can
be optionally requested through the expansion
field.
aw_get_calculatedmetrics( company_id = Sys.getenv("AW_COMPANY_ID"), rsids = NULL, ownerId = NULL, filterByIds = NULL, toBeUsedInRsid = NULL, locale = "en_US", name = NULL, tagNames = NULL, favorite = NULL, approved = NULL, limit = 1000, page = 0, sortDirection = "DESC", sortProperty = NULL, expansion = NULL, includeType = "all", debug = FALSE )
aw_get_calculatedmetrics( company_id = Sys.getenv("AW_COMPANY_ID"), rsids = NULL, ownerId = NULL, filterByIds = NULL, toBeUsedInRsid = NULL, locale = "en_US", name = NULL, tagNames = NULL, favorite = NULL, approved = NULL, limit = 1000, page = 0, sortDirection = "DESC", sortProperty = NULL, expansion = NULL, includeType = "all", debug = FALSE )
company_id |
Company ID. If an environment variable called |
rsids |
Filter the list to only include calculated metrics tied to a specified RSID or
list of RSIDs. Specify multiple RSIDs as a vector (i.e., " |
ownerId |
Filter the list to only include calculated metrics owned by the specified loginId. |
filterByIds |
Filter the list to only include calculated metrics in the specified list as specified by a single string or as a vector of strings. |
toBeUsedInRsid |
The report suite where the calculated metric is intended to be used. This
report suite is used to determine things like compatibility and permissions. If it is not specified,
then the permissions will be calculated based on the union of all metrics authorized in all groups
the user belongs to. If compatibility is specified for |
locale |
The locale that system-named metrics should be returned in. Non-localized values will be returned for title, name, description, etc. if a localized value is not available. |
name |
Filter the list to only include calculated metrics that contain the specified name. This is case-insensitive and is a simple, single string match. |
tagNames |
Filter the list to only include calculated metrics that contain one of the tags as specified by a single string or vector of strings. |
favorite |
Set to |
approved |
Set to |
limit |
The number of results to return per page. The default is 1,000. |
page |
The "page" of results to display. This works in conjunction with the |
sortDirection |
The sort direction for the results: |
sortProperty |
The property to sort the results by. Currently available values are |
expansion |
Additional calculated metric metadata fields to include in the results:
|
includeType |
Include additional calculated metrics not owned by user. Available values are |
debug |
Include the output and input of the api call in the console for debugging. Default is FALSE |
This function is useful/needed to identify the specific ID of a calculated metric for use in other
functions like aw_freeform_report
.
The expansion
argument accepts the following values, which will then include additional columns
in the results:
ownerFullName: adds owner.name
and owner.login
columns to the results (owner.id
is
already included by default).
modified: adds a modified
column to the output with the date (ISO 8601 format) each
calculated metric was last modified.
definition: adds multiple columns (the number will vary based on the number and complexity of calculated metrics returns) that provide the actual formula for each of the calculated metrics. This is returned from the API as a JSON object and converted into columns by the function, which means it is pretty messy, so, really, it's not recommended that you use this value.
compatability: should add a column with the products that the metric is compatible with, but this behavior has not actually been shown to be true, so this may actually do nothing if included.
reportSuiteName: adds a reportSuiteName
and a siteTitle
column with the friendly report
suite name for the RSID.
tags: adds a column with an embedded data frame with all of the existing tags that are associated with the calculated metric. This can be a bit messy to work with, but the information is, at least, there.
Multiple values for expansion
can be included in the argument as a vector. For instance,
expansion = c("tags", "modified")
will add both a tags
column and a modified
column to the output.
A data frame of calculated metrics and their metadata.
This will generate an extensive list of all the dimensions in the reportsuite.
aw_get_dimensions( rsid = Sys.getenv("AW_REPORTSUITE_ID"), locale = "en_US", segmentable = FALSE, reportable = FALSE, classifiable = FALSE, expansion = NULL, debug = FALSE, company_id = Sys.getenv("AW_COMPANY_ID") )
aw_get_dimensions( rsid = Sys.getenv("AW_REPORTSUITE_ID"), locale = "en_US", segmentable = FALSE, reportable = FALSE, classifiable = FALSE, expansion = NULL, debug = FALSE, company_id = Sys.getenv("AW_COMPANY_ID") )
rsid |
Adobe report suite ID (RSID). If an environment variable called |
locale |
The locale that dimension details should be returned in. The default is |
segmentable |
Boolean that determines whether or not to include dimensions that can be used in
segments. |
reportable |
Boolean that determines whether or not to include dimensions that can be used in
reports |
classifiable |
Boolean that determines whether or not to include dimensions that can be used in
classifications |
expansion |
Additional dimension metadata to include in the results: |
debug |
Include the output and input of the api call in the console for debugging. Default is FALSE |
company_id |
Company ID. If an environment variable called |
A data frame of dimensions and their meta data.
Get a data frame with all of the standard (non-calculated) metrics (measures) in the report suite.
aw_get_metrics( rsid = Sys.getenv("AW_REPORTSUITE_ID"), locale = "en_US", segmentable = "NULL", expansion = NULL, company_id = Sys.getenv("AW_COMPANY_ID"), debug = FALSE )
aw_get_metrics( rsid = Sys.getenv("AW_REPORTSUITE_ID"), locale = "en_US", segmentable = "NULL", expansion = NULL, company_id = Sys.getenv("AW_COMPANY_ID"), debug = FALSE )
rsid |
Adobe report suite ID (RSID). If an environment variable called |
locale |
The locale that system-named metrics should be returned in. Non-localized values will be returned for title, name, description, etc. if a localized value is not available. |
segmentable |
Boolean that determines whether or not to include metrics that can be used in
segments. |
expansion |
Additional metrics metadata to include in the results: |
company_id |
Company ID. If an environment variable called |
debug |
Include the output and input of the api call in the console for debugging. Default is FALSE |
This function is commonly used to get the correct ID for a specific metric or metrics that will be used in other function calls. The results returned are:
All of the "out of the box" metrics like visits, page views, visitors, orders, revenue, bounce rate, etc.
All of the enabled events that are configured in the report suite.
An instances metric for each enabled eVar.
This function does not return calculated metrics.
A data frame of metrics (excluding calculated metrics) and their meta data.
Returns a project configuration json string
aw_get_project_config( projectId = NULL, expansion = NULL, locale = "en_US", debug = FALSE, company_id = Sys.getenv("AW_COMPANY_ID") )
aw_get_project_config( projectId = NULL, expansion = NULL, locale = "en_US", debug = FALSE, company_id = Sys.getenv("AW_COMPANY_ID") )
projectId |
The Project id for which to retrieve information |
expansion |
Comma-delimited list of additional project metadata fields to include on response. Available values : reportSuiteName, shares, tags, accessLevel, modified, externalReferences, definition |
locale |
Locale Default value : en_US |
debug |
Set to |
company_id |
Company ID. If an environment variable called |
A json string
A list of projects in the account
aw_get_projects( includeType = "all", expansion = NULL, locale = "en_US", limit = 1000, page = 0, debug = FALSE, company_id = Sys.getenv("AW_COMPANY_ID") )
aw_get_projects( includeType = "all", expansion = NULL, locale = "en_US", limit = 1000, page = 0, debug = FALSE, company_id = Sys.getenv("AW_COMPANY_ID") )
includeType |
Include additional projects not owned by user. The "all" option takes precedence over "shared". If neither guided, or project is included, both types are returned |
expansion |
Comma-delimited list of additional project metadata fields to include on response. Available values : reportSuiteName, ownerFullName, modified, tags, accessLevel, externalReferences, definition |
locale |
Locale Default value : en_US |
limit |
Number of results per page. Default value: 1000 |
page |
Page number (base 0 - first page is "0") |
debug |
Set to |
company_id |
Company ID. If an environment variable called |
A data frame
Retrieve a list of report suites and meta data about each one.
aw_get_reportsuites( company_id = Sys.getenv("AW_COMPANY_ID"), rsids = NULL, rsidContains = NULL, limit = 10, page = 0, expansion = NULL, debug = FALSE )
aw_get_reportsuites( company_id = Sys.getenv("AW_COMPANY_ID"), rsids = NULL, rsidContains = NULL, limit = 10, page = 0, expansion = NULL, debug = FALSE )
company_id |
Company ID. If an environment variable called |
rsids |
Filter the results to include one or more specific report suites. Specify multiple RSIDs as
a vector (i.e., " |
rsidContains |
Filter the results list to only include suites that contain the specified string within the RSID. This is case-insensitive and is a simple, single string match. |
limit |
The number of results to return per page. This argument works in conjunction with the
|
page |
The "page" of results to display. This works in conjunction with the |
expansion |
Additional segment metadata fields to include in the results: |
debug |
Include the output and input of the api call in the console for debugging. Default is FALSE |
A data frame of report suites and their meta data.
Retrieve all segments or a filtered list of segments
aw_get_segments( company_id = Sys.getenv("AW_COMPANY_ID"), rsids = NULL, segmentFilter = NULL, locale = "en_US", name = NULL, tagNames = NULL, filterByPublishedSegments = "all", limit = 10, page = 0, sortDirection = "ASC", sortProperty = "id", expansion = NULL, includeType = "all", debug = FALSE )
aw_get_segments( company_id = Sys.getenv("AW_COMPANY_ID"), rsids = NULL, segmentFilter = NULL, locale = "en_US", name = NULL, tagNames = NULL, filterByPublishedSegments = "all", limit = 10, page = 0, sortDirection = "ASC", sortProperty = "id", expansion = NULL, includeType = "all", debug = FALSE )
company_id |
Company ID. If an environment variable called |
rsids |
Filter the list to only include segments tied to a specified RSID or
list of RSIDs. Specify multiple RSIDs as a vector (i.e., " |
segmentFilter |
Filter list to only include segments in the list of segment IDs (comma-delimited) |
locale |
The locale that segment details should be returned in. The default is |
name |
Filter the list to only include segments that contain the specified name. This is case-insensitive and is a simple, single string match. |
tagNames |
Filter the list to only include segments that contain one of the tags. |
filterByPublishedSegments |
Filter the list to only include segments where the published field is set to one of the allowable values:
|
limit |
The number of results to return per page. This argument works in conjunction with the
|
page |
The "page" of results to display. This works in conjunction with the |
sortDirection |
The sort direction for the results: |
sortProperty |
The property to sort the results by. Currently available values are |
expansion |
Additional segment metadata fields to include in the results: |
includeType |
Include additional segments not owned by the user. Available values are |
debug |
Include the output and input of the api call in the console for debugging. Default is FALSE |
A data frame of segments and their meta data.
Retrieve all tag names or search by component id or tag names
aw_get_tags( company_id = Sys.getenv("AW_COMPANY_ID"), componentId = NULL, componentType = NULL, tagNames = NULL, limit = 1000, page = 0, debug = FALSE )
aw_get_tags( company_id = Sys.getenv("AW_COMPANY_ID"), componentId = NULL, componentType = NULL, tagNames = NULL, limit = 1000, page = 0, debug = FALSE )
company_id |
Company ID. If an environment variable called |
componentId |
The component id being requested. Default is |
componentType |
The component type being requested. Options include segment, dashboard, bookmark, calculatedMetric, project, dateRange, metric, dimension, virtualReportSuite, scheduledJob, alert, classification. Default is NULL |
tagNames |
Comma separated vector of tag names. componentType |
limit |
The number of results to return per page. This argument works in conjunction with the
|
page |
The "page" of results to display. This works in conjunction with the |
debug |
Include the output and input of the api call in the console for debugging. Default is FALSE |
A data frame of tags and the associated meta data.
This is the equivalent of a freeform table with segments as the row
components. This type of table offers a few components that aw_freeform_table
does not. For example, this function does not require (or allow) dimensions
to be included in the breakdown. Segment IDs are automatically translated
into their human-readable names.
aw_segment_table( company_id = Sys.getenv("AW_COMPANY_ID"), rsid = Sys.getenv("AW_REPORTSUITE_ID"), segmentRsids, date_range = c(Sys.Date() - 30, Sys.Date() - 1), metrics = c("visits", "visitors"), globalSegment = NULL, segmentIds = NULL, debug = FALSE )
aw_segment_table( company_id = Sys.getenv("AW_COMPANY_ID"), rsid = Sys.getenv("AW_REPORTSUITE_ID"), segmentRsids, date_range = c(Sys.Date() - 30, Sys.Date() - 1), metrics = c("visits", "visitors"), globalSegment = NULL, segmentIds = NULL, debug = FALSE )
company_id |
Company ID |
rsid |
Report suite ID for the data pull |
segmentRsids |
Deprecated. |
date_range |
Date range |
metrics |
Metrics to request for each segment |
globalSegment |
One or more segments to apply globally over all other segments |
segmentIds |
One or more segments that will compose the rows of the table |
debug |
Logical, whether to make verbose requests to the API and view the whole exchange |
This is a specialized function.
To see segments broken down by dimensions, we recommend making multiple
requests to aw_freeform_table
with different global segments applied, and
then row-binding them together yourself.
Unlike aw_freeform_table
, this function automatically handles the 10-metric
restriction imposed by the API.
In short, segments are cheap, metrics are expensive. Adding 1 metric is the equivalent of adding 10 segments, judging by the number of requests necessary to collect the data.
The function does not currently support segment breakdowns, but you can stack segments by applying a global segment to your query.
tibble::tibble()
of segments and metrics. Rows are returned with
segments in the order they were requested, not by metric sorting.
This is the legacy mechanism for retrieving the authorization token using
OAuth. It has been replaced by aw_auth()
.
aw_token( client_id = Sys.getenv("AW_CLIENT_ID"), client_secret = Sys.getenv("AW_CLIENT_SECRET"), use_oob = TRUE )
aw_token( client_id = Sys.getenv("AW_CLIENT_ID"), client_secret = Sys.getenv("AW_CLIENT_SECRET"), use_oob = TRUE )
client_id |
defined by global variable or manually defined |
client_secret |
defined by global variable or manually defined |
use_oob |
for the purpose of testing. Default is set to TRUE |
An authorization token is saved the file name aa.oauth. If the file aa.oauth does not exist then one will be created at the end of the authorization process.
Organizes the arguments into a json string and then structures the data after the internal function makes the api call. Only runs a single dimension with as many metrics as you want.
aw_workspace_report(req_body = "", company_id = Sys.getenv("AW_COMPANY_ID"))
aw_workspace_report(req_body = "", company_id = Sys.getenv("AW_COMPANY_ID"))
req_body |
The json string copied from Workspace |
company_id |
Company Id. Taken from the global environment by default if not provided. |
A data frame of dimensions and metrics
This function combines formulas to create calculated metrics in Adobe Analytics
cm_build( name = NULL, description = NULL, formula = NULL, seg_filter = NULL, polarity = "positive", precision = 0, type = "decimal", create_cm = FALSE, tagNames = NULL, internal = FALSE, debug = FALSE, rsid = Sys.getenv("AW_REPORTSUITE_ID"), company_id = Sys.getenv("AW_COMPANY_ID") )
cm_build( name = NULL, description = NULL, formula = NULL, seg_filter = NULL, polarity = "positive", precision = 0, type = "decimal", create_cm = FALSE, tagNames = NULL, internal = FALSE, debug = FALSE, rsid = Sys.getenv("AW_REPORTSUITE_ID"), company_id = Sys.getenv("AW_COMPANY_ID") )
name |
This is the name of the new calculated metric (required) |
description |
This is the description of the segment (optional) |
formula |
Formulas are list objects created using the |
seg_filter |
A segment filter to be added to a metric in the formula |
polarity |
Also known as 'Show Upward Trend As' in the UI. Options include 'positive' (default) or 'negative'. This metric polarity setting shows whether Analytics should consider an upward trend in the metric as good (green) or bad (red). As a result, the report’s graph will show as green or red when it’s going up. |
precision |
Shows how many decimal places will be shown in the report.
The maximum number of decimal places you can specify is 10. Also known as 'Decimal Places' in the UI.
Default is |
type |
Choices include Decimal (default), Time, Percent, and Currency. Also known as 'Format' in the UI. |
create_cm |
Used to determine if the segment should be created in the report suite or if the definition should be returned to be validated using cm_validate. Default is FALSE |
tagNames |
Apply tag names to the newly created calculated metric. Single string or a vector. |
internal |
Determines if this segment is to be available in the UI.
Default is FALSE, meaning the segment will not be available in the UI, nor will
the ID be available in the |
debug |
This enables the api call information to show in the console for help with debugging issues. default is FALSE |
rsid |
Adobe report suite ID (RSID). If an environment variable called
|
company_id |
Company ID. If an environment variable called |
See more information here
If the "create_cm" argument is set to FALSE a list object definition will be returned. If the "create_cm" argument is set to TRUE and the calculated metric is valid it will return a data frame of the newly created calculated metric id along with some other basic meta data. If it returns an error then the error response will be returned to help understand what needs to be corrected.
This function copies and existing function and creates a duplicate based on the definition.
cm_copy( id, name = NULL, description = NULL, polarity = NULL, precision = NULL, type = NULL, create_cm = FALSE, debug = FALSE, rsid = NULL, company_id = Sys.getenv("AW_COMPANY_ID") )
cm_copy( id, name = NULL, description = NULL, polarity = NULL, precision = NULL, type = NULL, create_cm = FALSE, debug = FALSE, rsid = NULL, company_id = Sys.getenv("AW_COMPANY_ID") )
id |
The id of the old calculated metric |
name |
This is the name of the new calculated metric. If not provided, the prefix "Copy_" will be added to the existing name. (optional) |
description |
This is the description of the segment (optional) |
polarity |
Also known as 'Show Upward Trend As' in the UI. Options include 'positive' or 'negative'. Default is based on original calculated metric definition. This metric polarity setting shows whether Analytics should consider an upward trend in the metric as good (green) or bad (red). As a result, the report’s graph will show as green or red when it’s going up. Default is based on original calculated metric definition. |
precision |
Shows how many decimal places will be shown in the report. The maximum number of decimal places you can specify is 10. Also known as 'Decimal Places' in the UI. Default is based on original calculated metric definition. |
type |
Choices include decimal (default), time, percent, and currency. Also known as 'Format' in the UI. Default is based on original calculated metric definition. |
create_cm |
Used to determine if the segment should be created in the report suite or if the definition should be returned to be validated using cm_validate. Default is FALSE |
debug |
This enables the api call information to show in the console for help with debugging issues. default is FALSE |
rsid |
Adobe report suite ID (RSID). If an environment variable called
|
company_id |
Company ID. If an environment variable called |
See more information here
If the "create_cm" argument is set to FALSE a list object definition will be returned. If the "create_cm" argument is set to TRUE and the calculated metric is valid it will return a data frame of the newly created calculated metric id along with some other basic meta data. If it returns an error then the error response will be returned to help understand what needs to be corrected.
Use this function to delete a specific calculated metric.
cm_delete( id = NULL, warn = TRUE, locale = "en_US", debug = FALSE, rsid = Sys.getenv("AW_REPORTSUITE_ID"), company_id = Sys.getenv("AW_COMPANY_ID") )
cm_delete( id = NULL, warn = TRUE, locale = "en_US", debug = FALSE, rsid = Sys.getenv("AW_REPORTSUITE_ID"), company_id = Sys.getenv("AW_COMPANY_ID") )
id |
Calculated Metric ID to be deleted. |
warn |
Boolean of whether or not to include a warning message. |
locale |
language - default 'en_US' |
debug |
Default |
rsid |
Adobe report suite ID (RSID). If an environment variable called
|
company_id |
Company ID. If an environment variable called |
A string confirming the calculated metric is deleted
Returns a JSON string formula to be used to build a calculated (derived) metric.
cm_formula( operator = c("divide", "multiply", "subtract", "add"), metrics = c("visits", "singlepagevisits"), seg_filters = NA, rsid = Sys.getenv("AW_REPORTSUITE_ID"), company_id = Sys.getenv("AW_COMPANY_ID") )
cm_formula( operator = c("divide", "multiply", "subtract", "add"), metrics = c("visits", "singlepagevisits"), seg_filters = NA, rsid = Sys.getenv("AW_REPORTSUITE_ID"), company_id = Sys.getenv("AW_COMPANY_ID") )
operator |
Formula operators are divide (default), multiply, subtract, or add. |
metrics |
The one or two metrics in a formula calculation |
seg_filters |
A vector of segment filters to be added to a metric in the formula |
rsid |
Adobe report suite ID (RSID). If an environment variable called
|
company_id |
Company ID. If an environment variable called |
A JSON string formula to be used in a calculated metric
Returns a JSON string defining a function to be used to build a calculated (derived) metric.
cm_function( func = "col-sum", metric = "visits", dimension = NULL, seg_filter = NULL, rsid = Sys.getenv("AW_REPORTSUITE_ID"), company_id = Sys.getenv("AW_COMPANY_ID") )
cm_function( func = "col-sum", metric = "visits", dimension = NULL, seg_filter = NULL, rsid = Sys.getenv("AW_REPORTSUITE_ID"), company_id = Sys.getenv("AW_COMPANY_ID") )
func |
Calculated function id. Only Basic single metric functions are able to be used. |
metric |
The metric to be used in the functional metric calculation. Default is |
dimension |
The dimension to be used in the functional metric calculation. Default is |
seg_filter |
A segment filter to be added to a metric in the formula |
rsid |
Adobe report suite ID (RSID). If an environment variable called
|
company_id |
Company ID. If an environment variable called |
Returns a full list of calculated metric functions or a specified function that the user can access.
Update a specific calculated metric.
cm_update( id = NULL, updates = NULL, locale = "en_US", debug = FALSE, company_id = Sys.getenv("AW_COMPANY_ID") )
cm_update( id = NULL, updates = NULL, locale = "en_US", debug = FALSE, company_id = Sys.getenv("AW_COMPANY_ID") )
id |
Returns details around a single calculated metric function if you specify the id. You can obtain the desired id by not including an ID value and finding the function in the results. |
updates |
List of changes or entire JSON definition object. |
locale |
All calculated metrics endpoints support the URL query parameter locale. Supported values are en_US, fr_FR, ja_JP, de_DE, es_ES, ko_KR, pt_BR, zh_CN, and zh_TW. This argument specifies which language is to be used for localized sections of responses. |
debug |
Set to |
company_id |
Company ID. If an environment variable called |
Returns a json string of information about the updated calculated metric
This function checks if a calculated metric JSON string is valid
cm_val( definition = NULL, locale = "en_US", migrating = FALSE, debug = FALSE, rsid = Sys.getenv("AW_REPORTSUITE_ID"), company_id = Sys.getenv("AW_COMPANY_ID") )
cm_val( definition = NULL, locale = "en_US", migrating = FALSE, debug = FALSE, rsid = Sys.getenv("AW_REPORTSUITE_ID"), company_id = Sys.getenv("AW_COMPANY_ID") )
definition |
json string definition of a calculated metric |
locale |
The location of the language. en-US is default. |
migrating |
Include migration functions in validation. FALSE is default. |
debug |
This enables the api call information to show in the console for help with debugging issues. default is FALSE |
rsid |
Adobe report suite ID (RSID). If an environment variable called
|
company_id |
Company ID. If an environment variable called |
See more information here
A string confirming the calculated metric is valid or is not valid.
Returns a full list of calculated metric functions that the user can access.
get_cm_functions( id = NULL, debug = FALSE, company_id = Sys.getenv("AW_COMPANY_ID") )
get_cm_functions( id = NULL, debug = FALSE, company_id = Sys.getenv("AW_COMPANY_ID") )
id |
Returns details around a single calculated metric function if you specify the id. You can obtain the desired id by not including an ID value and finding the function in the results. |
debug |
Set to |
company_id |
Company ID. If an environment variable called |
Returns a full list of calculated metric functions or a specified function that the user can access.
This function will quickly pull the list of company ids that you have access to.
get_me(req_path = "discovery/me")
get_me(req_path = "discovery/me")
req_path |
The endpoint for that particular report |
A data frame of company ids and company names
## Not run: get_me() ## End(Not run)
## Not run: get_me() ## End(Not run)
This function returns the usage and access logs for a given date range within a 3 month period. The user must have Admin Console / Logs permissions (must be able to view the Usage & Access Log data in the web interface) in order to use this function.
get_usage_logs( startDate = Sys.Date() - 91, endDate = Sys.Date() - 1, login = NULL, ip = NULL, rsid = NULL, eventType = NULL, event = NULL, limit = 100, page = 0, debug = FALSE, company_id = Sys.getenv("AW_COMPANY_ID") )
get_usage_logs( startDate = Sys.Date() - 91, endDate = Sys.Date() - 1, login = NULL, ip = NULL, rsid = NULL, eventType = NULL, event = NULL, limit = 100, page = 0, debug = FALSE, company_id = Sys.getenv("AW_COMPANY_ID") )
startDate |
Start date for the maximum of a 3 month period. |
endDate |
End date for the maximum of a 3 month period. |
login |
The login value of the user you want to filter logs by. |
ip |
The IP address you want to filter logs by. |
rsid |
The report suite ID you want to filter logs by. |
eventType |
The numeric id for the event type you want to filter logs by. Leaving this blank returns all events. See the Usage Logs API Guide for a complete list of event types. |
event |
The event description you want to filter logs by. No wildcards are permitted. |
limit |
The number of results to return per page. This argument works in conjunction with the
|
page |
The "page" of results to display. This works in conjunction with the |
debug |
Include the output and input of the api call in the console for debugging. Default is FALSE |
company_id |
Company ID. If an environment variable called |
A data frame of logged events and the event meta data.
## Not run: get_usage_logs(startDate = Sys.Date()-91, endDate = Sys.Date()-1, limit = 100, page = 0) ## End(Not run)
## Not run: get_usage_logs(startDate = Sys.Date()-91, endDate = Sys.Date()-1, limit = 100, page = 0) ## End(Not run)
Retrieves a list of all users for the company designated by the auth token.
get_users(company_id = Sys.getenv("AW_COMPANY_ID"), limit = 10, page = 0)
get_users(company_id = Sys.getenv("AW_COMPANY_ID"), limit = 10, page = 0)
company_id |
Company ID. If an environment variable called |
limit |
The number of results to return per page. This argument works in conjunction with the
|
page |
The "page" of results to display. This works in conjunction with the |
A data frame of users and their meta data.
## Not run: get_users(limit = 10, page = 0) ## End(Not run)
## Not run: get_users(limit = 10, page = 0) ## End(Not run)
Creates a new project in Adobe. Note: very early in development
proj_build( body = NULL, expansion = NULL, locale = "en_US", debug = FALSE, company_id = Sys.getenv("AW_COMPANY_ID") )
proj_build( body = NULL, expansion = NULL, locale = "en_US", debug = FALSE, company_id = Sys.getenv("AW_COMPANY_ID") )
body |
The project json string which include the configuration and definition |
expansion |
Comma-delimited list of additional project metadata fields to include on response. Available values : reportSuiteName, shares, tags, accessLevel, modified, externalReferences, definition |
locale |
Locale Default value : en_US |
debug |
Set to |
company_id |
Company ID. If an environment variable called |
A json string
Edits an existing project in Adobe. Note: very early in development
proj_update( projectId = NULL, body = NULL, expansion = NULL, locale = "en_US", debug = FALSE, company_id = Sys.getenv("AW_COMPANY_ID") )
proj_update( projectId = NULL, body = NULL, expansion = NULL, locale = "en_US", debug = FALSE, company_id = Sys.getenv("AW_COMPANY_ID") )
projectId |
The project id to be edited |
body |
The json string in list format which includes the edits to be made |
expansion |
Comma-delimited list of additional project metadata fields to include on response. Available values : reportSuiteName, shares, tags, accessLevel, modified, externalReferences, definition |
locale |
Locale Default value : en_US |
debug |
Set to |
company_id |
Company ID. If an environment variable called |
A json string
This function combines rules, containers and/or sequences into a single JSON string and can then make the post call to create the segment in Adobe Analytics or return the json string for use in other api calls or for validation.
seg_build( name = NULL, description = NULL, containers = NULL, rules = NULL, sequences = NULL, context = "hits", conjunction = "and", sequence = "in_order", sequence_context = "hits", exclude = FALSE, create_seg = FALSE, tagNames = NULL, internal = FALSE, debug = FALSE, rsid = Sys.getenv("AW_REPORTSUITE_ID"), company_id = Sys.getenv("AW_COMPANY_ID") )
seg_build( name = NULL, description = NULL, containers = NULL, rules = NULL, sequences = NULL, context = "hits", conjunction = "and", sequence = "in_order", sequence_context = "hits", exclude = FALSE, create_seg = FALSE, tagNames = NULL, internal = FALSE, debug = FALSE, rsid = Sys.getenv("AW_REPORTSUITE_ID"), company_id = Sys.getenv("AW_COMPANY_ID") )
name |
This is the name of the new segment (required) |
description |
This is the description of the segment (required) |
containers |
List of the container(s) that make up the segment. Containers
are list objects created using the |
rules |
List of the rule(s) to create a segment. Rules are list objects
created using the |
sequences |
List of the rule(s) and sequence container(s) that are combined
to make a segment. Sequence containers are list objects created using the |
context |
Defines the level that the segment logic should operate on. Valid values are visitors, visits, and hits. See Details |
conjunction |
This will tell how the different containers and rules should be compared. Use either 'and' or 'or'. |
sequence |
Used to define if the segment should be 'in_order' (default), 'after', or 'before' the sequence of events |
sequence_context |
Used to define the sequential items context which should be below the container context. ex. if container context is visitors then the sequence_context should be visits or hits |
exclude |
Excludes the main container which will include all rules. Only used when the rule arguments are used. |
create_seg |
Used to determine if the segment should be created in the report suite or if the definition should be returned to be used in a freeform table API call. Default is FALSE |
tagNames |
Apply tag names to the newly created calculated metric. Single string or a vector. |
internal |
Determines if this segment is to be available in the UI.
Default is FALSE, meaning the segment will not be available in the UI, nor will
the ID be available in the |
debug |
This enables the api call information to show in the console for help with debugging issues. default is FALSE |
rsid |
Adobe report suite ID (RSID). If an environment variable called
|
company_id |
Company ID. If an environment variable called |
Context
The rules in a segment have a context that specify the level of operation. The context can be "visitors", "visits" or "hits." As an example, let's build a segment rule where revenue is greater than 0 (meaning a purchase took place) and change the context to see how things change. If the context is set to "visitors", the segment includes all hits from visitors that have a purchase of some kind during a visit. This is useful in analyzing customer behavior in visits leading up to a purchase and possibly behavior after a purchase. If the context is set to "visits", the segment includes all hits from visits where a purchase occurred. This is useful for seeing the behavior of a visitor in immediate page views leading up to the purchase. If the context is set to "hits", the segment only includes hits where a purchase occurred, and no other hits. This is useful in seeing which products were most popular. In the above example, the context for the container listed is hits. This means that the container only evaluates data at the hit level, (in contrast to visit or visitor level). The rows in the container are also at the hit level.
If the "create_seg" argument is set to FALSE a JSON string definition will be returned. If the "create_seg" argument is set to TRUE and the segment is valid it will return a data frame of the newly created segment id along with some other basic meta data. If it returns an error then the error response will be returned to help understand what needs to be corrected.
This function combines rules into a container.
seg_con(context = "hits", conjunction = "and", rules = NULL, exclude = FALSE)
seg_con(context = "hits", conjunction = "and", rules = NULL, exclude = FALSE)
context |
Defines the level that the segment logic should operate on. Valid values are visitors, visits, and hits. See Details |
conjunction |
This defines the relationship of the rules. |
rules |
List of rules and/or containers. Must be wrapped in a list() function. Adding a container list item will nest it within a container. |
exclude |
Exclude the entire container |
Context
The rules in a segment have a context that specify the level of operation. The context can be "visitors", "visits" or "hits." As an example, let's build a segment rule where revenue is greater than 0 (meaning a purchase took place) and change the context to see how things change. If the context is set to "visitors", the segment includes all hits from visitors that have a purchase of some kind during a visit. This is useful in analyzing customer behavior in visits leading up to a purchase and possibly behavior after a purchase. If the context is set to "visits", the segment includes all hits from visits where a purchase occurred. This is useful for seeing the behavior of a visitor in immediate page views leading up to the purchase. If the context is set to "hit", the segment only includes hits where a purchase occurred, and no other hits. This is useful in seeing which products were most popular. In the above example, the context for the container listed is hits. This means that the container only evaluates data at the hit level, (in contrast to visit or visitor level). The rules in the container are also at the hit level.
a structured list of containers to be used to build the segment
This function copies and existing function and creates a duplicate based on the definition.
seg_copy( id, name = NULL, description = NULL, polarity = NULL, precision = NULL, type = NULL, create_seg = FALSE, debug = FALSE, rsid = NULL, company_id = Sys.getenv("AW_COMPANY_ID") )
seg_copy( id, name = NULL, description = NULL, polarity = NULL, precision = NULL, type = NULL, create_seg = FALSE, debug = FALSE, rsid = NULL, company_id = Sys.getenv("AW_COMPANY_ID") )
id |
The id of the old segment |
name |
This is the name of the new segment. If not provided, the prefix "Copy_" will be added to the existing name. (optional) |
description |
This is the description of the segment (optional) |
polarity |
Also known as 'Show Upward Trend As' in the UI. Options include 'positive' or 'negative'. Default is based on original segment definition. This metric polarity setting shows whether Analytics should consider an upward trend in the metric as good (green) or bad (red). As a result, the report’s graph will show as green or red when it’s going up. Default is based on original segment definition. |
precision |
Shows how many decimal places will be shown in the report. The maximum number of decimal places you can specify is 10. Also known as 'Decimal Places' in the UI. Default is based on original segment definition. |
type |
Choices include decimal (default), time, percent, and currency. Also known as 'Format' in the UI. Default is based on original segment definition. |
create_seg |
Used to determine if the segment should be created in the report suite or if the definition should be returned to be validated using seg_val. Default is FALSE |
debug |
This enables the api call information to show in the console for help with debugging issues. default is FALSE |
rsid |
Adobe report suite ID (RSID). If an environment variable called
|
company_id |
Company ID. If an environment variable called |
See more information here
If the "create_seg" argument is set to FALSE a list object definition will be returned. If the "create_seg" argument is set to TRUE and the segment is valid it will return a data frame of the newly created segment id along with some other basic meta data. If it returns an error then the error response will be returned to help understand what needs to be corrected.
Use this function to delete a specific segment in Adobe Analytics
seg_delete( id = NULL, warn = TRUE, locale = "en_US", debug = FALSE, rsid = Sys.getenv("AW_REPORTSUITE_ID"), company_id = Sys.getenv("AW_COMPANY_ID") )
seg_delete( id = NULL, warn = TRUE, locale = "en_US", debug = FALSE, rsid = Sys.getenv("AW_REPORTSUITE_ID"), company_id = Sys.getenv("AW_COMPANY_ID") )
id |
Segment ID to be deleted. |
warn |
Boolean of whether or not to include a warning message. |
locale |
language - default 'en_US' |
debug |
Default |
rsid |
Adobe report suite ID (RSID). If an environment variable called
|
company_id |
Company ID. If an environment variable called |
A string confirming the segment has or has not been deleted
This function creates the simple rule of a segment.
seg_rule( dimension = NULL, metric = NULL, verb = NULL, object = NULL, description = NULL, is_distinct = FALSE, attribution = "repeating", attribution_context = "visitors", validate = FALSE, rsid = Sys.getenv("AW_REPORTSUITE_ID"), company_id = Sys.getenv("AW_COMPANY_ID") )
seg_rule( dimension = NULL, metric = NULL, verb = NULL, object = NULL, description = NULL, is_distinct = FALSE, attribution = "repeating", attribution_context = "visitors", validate = FALSE, rsid = Sys.getenv("AW_REPORTSUITE_ID"), company_id = Sys.getenv("AW_COMPANY_ID") )
dimension |
This is the subject of the rule. The value should be the dimension id. Only the dimension or metric can be used at a time. |
metric |
This is the subject of the rule. The value should be the metric id. Only the dimension or metric can be used at a time. |
verb |
Choose from any of the 30 different verbs. Use the |
object |
This is the object of the rule and answers the question |
description |
The internal description for the rule. (optional) This will not show in the UI but could be very helpful when using the API. |
is_distinct |
This will segment on a distinct count of items within a dimension. Examples: “Visitors who viewed more than 5 distinct products,” or “Visits where more than 5 distinct pages were seen.” |
attribution |
Define the type of attribution. Either |
attribution_context |
When applying a non-repeating instance attribution
model to a rule the context for the attribution must be |
validate |
Set to TRUE when metric or dimension validation is preferred. Default is FALSE. Validation will slow down the function response time but ensure a valid rule result. |
rsid |
Adobe report suite ID (RSID). If an environment variable called
|
company_id |
Company ID. If an environment variable called |
Attribution Models Available for dimensions only, these models determine what values in a dimension to segment for. Dimension models are particularly useful in sequential segmentation.
repeating (default): Includes instances and persisted values for the dimension.
instance: Includes instances for the dimension.
nonrepeating instance: Includes unique instances (non-repeating) for the dimension. This is the model applied in Flow when repeat instances are excluded.
A structured list defining the rule for a segment
This function combines rules into a sequence container.
seg_seq( context = "visits", rules = NULL, sequence = "in_order", exclude = FALSE, exclude_checkpoint = NULL )
seg_seq( context = "visits", rules = NULL, sequence = "in_order", exclude = FALSE, exclude_checkpoint = NULL )
context |
Defines the level that the segment logic should operate on. Valid values for sequential segments is visitors and visits. See Details |
rules |
List of rules created using |
sequence |
How should the sequence of items be considered.
Options: |
exclude |
Excludes the entire sequence container which will include all rules. |
exclude_checkpoint |
Which checkpoints (rules) should be excluded.
Example |
Context
The rules in a segment have a context that specify the level of operation. The context can be "visitors", "visits" or "hits." As an example, let's build a segment rule where revenue is greater than 0 (meaning a purchase took place) and change the context to see how things change. If the context is set to "visitors", the segment includes all hits from visitors that have a purchase of some kind during a visit. This is useful in analyzing customer behavior in visits leading up to a purchase and possibly behavior after a purchase. If the context is set to "visits", the segment includes all hits from visits where a purchase occurred. This is useful for seeing the behavior of a visitor in immediate page views leading up to the purchase. If the context is set to "hits", the segment only includes hits where a purchase occurred, and no other hits. This is useful in seeing which products were most popular. In the above example, the context for the container listed is hits. This means that the container only evaluates data at the hit level, (in contrast to visit or visitor level). The rows in the container are also at the hit level.
Exclude checkpoint
Ensures the next checkpoint doesn't happen between the preceding checkpoint and the subsequent checkpoint. If there is no subsequent checkpoint then the excluded checkpoint must not occur at any point after the preceding checkpoint. If there is no preceding checkpoint then the excluded checkpoint must not have occurred at any point preceding the subsequent checkpoint.
More Information
Sequential segments can be difficult to get right. Referencing this article can help: https://experienceleague.adobe.com/docs/analytics/components/segmentation/segmentation-workflow/seg-sequential-build.html?lang=en
a structured list of containers to be used to build the segment
This function creates a then list object which restricts the time constraint of a segment to be added to a sequence segment.
seg_then(limit = "within", count = 1, unit = "year")
seg_then(limit = "within", count = 1, unit = "year")
limit |
The limitation of the restriction. Either |
count |
How many of the units should be used. |
unit |
A unit of time. Valid values are |
seg_then
argumentsIn the UI you can add 'after' and 'within' statements to create a more complex time restriction.
The same can be accomplished using this function by listing the limits, counts, and units in a c()
function. This would look like: limit = c('within', 'after'), count = c(5, 1), unit = c('hit', 'visit')
seg_then
function callTime restrictions can only be combined using 'within' first before 'after'. The function will automatically align these to be in the correct list item order.
Currently pageviews
and dimensions
are not supported unit values.
a structured list of time restrictions to be used to build the sequential segment
Update a specific segment
seg_update( id = NULL, updates = NULL, locale = "en_US", debug = FALSE, company_id = Sys.getenv("AW_COMPANY_ID") )
seg_update( id = NULL, updates = NULL, locale = "en_US", debug = FALSE, company_id = Sys.getenv("AW_COMPANY_ID") )
id |
The id of the segment you are wanting to update |
updates |
List of changes or entire definition object as a list object. |
locale |
The URL query parameter locale. Supported values are en_US, fr_FR, ja_JP, de_DE, es_ES, ko_KR, pt_BR, zh_CN, and zh_TW. This argument specifies which language is to be used for localized sections of responses. |
debug |
Set to |
company_id |
Company ID. If an environment variable called |
json string of updated segment information
Returns a segment validation response for a segment contained in a json string object.
seg_val( segment_body = NULL, rsid = Sys.getenv("AW_REPORTSUITE_ID"), debug = FALSE, company_id = Sys.getenv("AW_COMPANY_ID") )
seg_val( segment_body = NULL, rsid = Sys.getenv("AW_REPORTSUITE_ID"), debug = FALSE, company_id = Sys.getenv("AW_COMPANY_ID") )
segment_body |
The json string of the segment that is being validated (required) |
rsid |
Adobe report suite ID (RSID). If an environment variable called |
debug |
This enables the api call information to show in the console for help with debugging issues. default is FALSE |
company_id |
Company ID. If an environment variable called |
If the segment is valid a message saying the segment validates is returned. If the segment doesn't validate the errors are returned in a data frame.
A dataset containing the list of available verbs to be used in segment rules.
seg_verbs
seg_verbs
A data frame with 34 rows and 5 variables:
one of number, string, or exists
gives the context of the type of value is expected, either string, list, glob, number, or exists
the actual verb id to be used in the segment defition
a simple description of the verb
specifies what argument to use when building the segment verb function
...
Enables the creation of a new tag and applies the new tag to the passed component
tags_add( company_id = Sys.getenv("AW_COMPANY_ID"), componentId = NULL, componentType = NULL, tagNames = NULL, overwrite = FALSE, debug = FALSE )
tags_add( company_id = Sys.getenv("AW_COMPANY_ID"), componentId = NULL, componentType = NULL, tagNames = NULL, overwrite = FALSE, debug = FALSE )
company_id |
Company ID. If an environment variable called |
componentId |
The component id being requested. Default is |
componentType |
The component type being requested. Options include segment, dashboard, bookmark, calculatedMetric, project, dateRange, metric, dimension, virtualReportSuite, scheduledJob, alert, classification. Default is NULL |
tagNames |
Comma separated vector of tag names. |
overwrite |
Overwrite the existing tag names on a component. To append a new tag name use FALSE (default). To overwrite the existing tags on a component use TRUE. |
debug |
Include the output and input of the api call in the console for debugging. Default is FALSE |
A data frame of segments and their meta data.