Custom Dimensions
Custom Dimensions are used to store additional information for a visitor, session or pageview within Decibel. Information stored in Custom Dimensions can be demographic (for example gender or age range), product related (for example product codes or order IDs) or customer specific (such as a customer reward program number or tier).
Configuring Custom Dimensions
Custom Dimensions can be created by going to Settings > Custom Dimensions from your Decibel account. Click the Add Custom Dimension button where you will presented with the following screen.
On this screen, enter a Name and an optional Description to explain the purpose of the Custom Dimension to other Decibel users.
You will then need to select the appropriate Type for the data you wish to store in the Custom Dimension:
- String – for textual data
- Boolean – for yes/no or true/false values
- Number – for numerical values
- Choice – for a pre-defined list of options. If Choice is selected, you must also enter a comma-separated list of choices (for example, “Gold,Silver,Bronze”)
Now select the appropriate Scope for the Custom Dimension:
- Pageview – for data that applies to the current pageview only, for example the Product ID of the product shown on the current page.
- Session – for data that applies to the current session, for example the Order ID of a completed transaction.
- Visitor – for data that applies to the current visitor across all of their sessions, for example their reward program tier.
Followed by selecting the Integration method for Custom Dimension data retrieval:
- Decibel JavaScript API Call – to push the Custom Dimension data using an on-page call to the Decibel JavaScript API, as described below.
- Load from JavaScript Variable – for data that is exposed in a JavaScript variable (for example the data layer) on the page. If selected, enter the name of the JavaScript variable containing the data.
- Retrieve from URL Parameter – if the value is present in a query string parameter in the page URL. If selected, enter the name of the URL parameter containing the data.
Once happy, click Save Custom Dimension.
Triggering Custom Dimensions
As mentioned above, if you select Load from JavaScript Variable or Retrieve from URL parameter, you simply need to add the relevant information into the text box.
However, if the selected Integration method for a Custom Dimension is “Decibel JavaScript API Call”, the correct JavaScript code must be added to the website.
You can find the relevant custom dimension code for any custom dimensions that you have created by going to Settings > Custom Dimensions and clicking the Show integration code button (below).
The following example shows a Custom Dimension value being sent when a particular element on the page is clicked:
<script type="text/javascript"> var buttonEl = document.querySelector('#addToBasket'); buttonEl.addEventListener('click', function () { var totalEl = document.querySelector('#total'); decibelInsight('sendCustomDimension', 'Basket Value', totalEl.innerText); }); </script>
The sendCustomDimension end-point sends Custom Dimension data to Decibel. The second parameter is the Custom Dimension name and the third parameter contains the value of the custom dimension to be set.
Using Custom Dimensions
Once created, you can use Custom Dimensions as Filters in Segments, while you can also search for sessions that match with Custom Dimension data, such as Order IDs.
In the Sessions Dashboard, using the Filters button, you will be presented with the following screen (below). From the drop-down list next to Search, select the Custom Dimension name that you want to search data for, before using the search text box to type in your query. Click Apply changes to see the results.
Editing Custom Dimensions
To edit a Custom Dimension, simply click the Edit icon next to the relevant custom dimension (above), where you will presented with the same option as when you were creating the custom dimension.
Deleting Custom Dimensions
To delete a custom dimension, simply click the Delete icon (above) on the Custom Dimensions dashboard next to the relevant custom dimension that you want to delete.