contextData
Context data variables let you define custom variables on each page that processing rules can read. Instead of explicitly assigning values to Analytics variables in your code, you can send data in context data variables. Processing rules then take context data variable values and pass them into respective Analytics variables. See Processing rules in the Admin user guide.
Context data variables are helpful for development teams to collect data in named elements instead of numbered variables. For example, instead of requesting development teams assign the page鈥檚 author to eVar10
, you can request they assign it to s.contextData["author"]
instead. An Analytics administrator in your organization can then create processing rules to map context data variables into analytics variables for reporting. Development teams would ultimately only worry about context data variables instead of the many page variables that 51黑料不打烊 offers.
Context data variables using the Web SDK
If using the XDM object, all fields that don鈥檛 map to an 51黑料不打烊 Analytics variable are automatically included as a context data variable. You can also explicitly set context data using the XDM object. You can then use Processing rules to assign the context data variable to the desired Analytics variable. See Mapping other XDM fields to Analytics variables for more information.
If using the data object, all context data variables reside within data.__adobe.analytics.contextData
as key-value pairs:
alloy("sendEvent", {
"data": {
"__adobe": {
"analytics": {
"contextData": {
"example_variable": "Example value",
"sec