Segmenting your data with custom dimensions

Segmenting your data with custom dimensions

Sending a custom dimension

Custom dimensions let you add your own context to a visit, such as a customer type, a logged-in state or an A/B variant. You can then filter and segment your Exatom reports by that context.

Code snippet

Add this snippet to your website, or to a Custom HTML tag in Google Tag Manager, after the Exatom tag. Replace customer_type and returning with your own key and value.

<script>
(function () {
function sendDimension () {
window.Exatom?.trackDimension?.('customer_type', 'returning')
}

if (window.Exatom?.initialized) {
sendDimension()
} else {
document.body.addEventListener('ExatomPageview', sendDimension, { once: true })
}
})()
</script>

If you are sure the Exatom tag has already loaded, for example inside a click handler, one line is enough:

window.Exatom?.trackDimension?.('customer_type', 'returning')

Keys and values

  • Key (required): a non-empty text string. Calls with an empty key, or a key that is not a string, are ignored.
  • Value (optional): a text string. If you leave it out, or pass an empty value, only the key is stored. Numbers are sent as text. Do not pass objects or arrays.
  • Allowed characters: letters a to z (upper and lower case), digits, spaces and + _ - ( ) { } [ ] ; : , . ? ! @ # $ % ^ * ~ / |
  • Removed characters: anything else is stripped, including = & < > ' " and accented letters such as é or ü.
  • Maximum length: key and value together at max 127 characters.

Good to know

  • Sent once per session: the same key and value are recorded only once per session, so you can safely call the snippet on every page.
  • No personal data: never send names, email addresses, phone numbers or other personal data as a dimension.
  • Checking it works: open the Exatom debugger on your page. Every dimension that is sent appears as a DIMENSION record.