# Concatenate existing dimensions to create new custom dimension

**URL:** <https://community.piwik.pro/t/concatenate-existing-dimensions-to-create-new-custom-dimension/2943>\
**Category:** Data collection and tags\
**Created:** [September 22, 2023, 4:32am UTC](https://community.piwik.pro/t/concatenate-existing-dimensions-to-create-new-custom-dimension/2943 "2023-09-22T04:32:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jsteckler](https://avatars.discourse-cdn.com/v4/letter/j/ba8739/32.png) [@jsteckler](https://community.piwik.pro/u/jsteckler)\
**Post date:** [September 22, 2023, 4:32am UTC](https://community.piwik.pro/t/concatenate-existing-dimensions-to-create-new-custom-dimension/2943/1 "2023-09-22T04:32:51Z")

</div>

Hi all,

So we have a working, custom dimension called “ISP” which we reference in conjunction with Piwik’s native Provider and Organization dimensions to identify internal vs. external traffic. Using all three gives us the most complete picture, but it also entails a whole lot of repeated and/or conditional rules any time we’d like to create a new segment or filters to cover all three potential value sources.

Creating a new dimension that is simply a concatenation of the values recorded for each of the three dimensions seems like it would simplify such a process quite a bit. I began trying to leverage Tag Manager to generate the concatenated value of the new, prospective Custom Dimension, before realizing (a) that Location-category dimensional values don’t seem to be available at the time a Custom JS-type variable runs; and (b) that there seem to be some limitations when it comes to accessing data layer variables (“ISP” in our case), which may or may not be a relevant factor here.

Could you help guide me in the right direction, given the goal here? Is this possible via Tag Manager, or does this require some other approach? To reiterate, basically we’re just looking for the result of something like the below to be recorded as a dimension/value we could report on and leverage as needed:

```auto
function() {
  return {{ISP}} + ' || ' + {{Provider}} + ' || ' + {{Organization}}}; 
}

```

---

<div class="post-metadata">

**Author:** ![Adam](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/adam/32/1494_2.png) [@Adam](https://community.piwik.pro/u/Adam)\
**Post date:** [September 22, 2023, 10:59am UTC](https://community.piwik.pro/t/concatenate-existing-dimensions-to-create-new-custom-dimension/2943/2 "2023-09-22T10:59:24Z")

</div>

Hi @jsteckler,

Not sure if I understood you correctly but it seems to me that you would like to create your own metric to have possibility to use it in your reports? If so, please take a look at this article: [Create your own calculated metrics | Piwik PRO help center](https://help.piwik.pro/support/reports/calculated-metrics/)

It gives you possibility to create your own calculted metric. Please let me know if that was the case

---

<div class="post-metadata">

**Author:** ![jsteckler](https://avatars.discourse-cdn.com/v4/letter/j/ba8739/32.png) [@jsteckler](https://community.piwik.pro/u/jsteckler)\
**Post date:** [September 22, 2023, 1:57pm UTC](https://community.piwik.pro/t/concatenate-existing-dimensions-to-create-new-custom-dimension/2943/3 "2023-09-22T13:57:22Z")

</div>

Hi @Adam,

Thanks so much for taking the time to take a crack at this — I really appreciate it.

I’m pretty sure you understand me correctly _conceptually_. What I have in mind (or had hoped) is definitely similar in nature to Piwik’s “Calculated Metrics” feature. But as far as I can tell, calculated metrics can only leverage mathematical formulas to manipulate numeric-based dimensional values.

In my case, I’m looking to combine three text-based dimensional values into a single dimensional value. The goal is to greatly reduce the number of redundant conditional filters I’m presently forced to apply to ensure the values that I’m looking to exclude — which can be found in any combination of the three fields for a given session, but never all three — are totally accounted for.

It’s programmatically very simple in theory but, as I understand it, there’s no way for Tag Manager to access the server-side values captured by Piwik’s `Location` or `Organization` field.

If “Calculated Metrics” supported a _string_ or _text_ formatting-type option, that would do the trick. Unfortunately, the only options offered there are number, time, percentage or currency.

That clear things up? Happy to be told I’m missing something obvious. Also happy to further clarify my objective if I can.

Thanks again, man!

---

<div class="post-metadata">

**Author:** ![Adam](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/adam/32/1494_2.png) [@Adam](https://community.piwik.pro/u/Adam)\
**Post date:** [September 25, 2023, 8:58am UTC](https://community.piwik.pro/t/concatenate-existing-dimensions-to-create-new-custom-dimension/2943/4 "2023-09-25T08:58:09Z")

</div>

Hi @jsteckler,

I think I know your needs know. Unfortunately, values like location or organization can’t be accessed from the Tag manager point of view, here is the list of built in variables we can access:

> **[About built-in variables | Piwik PRO help center](https://help.piwik.pro/support/tag-manager/about-built-in-variables/)**
>
> Here’s a list of built-in variables in Piwik PRO. You can use them in tags and triggers. Variable name Description Click ID Contains the ID of the clicked element. It changes its value when a visitor clicks an element with the chosen ID. Click Url...

However, if you would like to get value from custom dimension you can use [getCustomDimensionValue function](https://developers.piwik.pro/en/latest/data_collection/web/javascript_tracking_client/api.html?highlight=getCustomDimensionValue#getCustomDimensionValue) and based on its value create a new one. You just need to keep in mind that you should get the value of custom dimension within specific event to get the value you need.

Hope my hints will help you
