in Analytics, under Admin -> Property -> Custom Dimension
I did create a Custom Dimension with index 1, scope session, the name abTestDesign
Also, I did create a custom segment with the name 'AbTestDesign=1' which is defined as abTestDesign (custom Dimension) contains 1. I can see this segment in Google Analytics.
For the potion of the website traffic, I did change the Analytics Code to the following (I did follow the instructions from https://developers.google.com/analytics/devguides/collection/gtagjs/custom-dims-mets thanks @MichelePisani for help to reach this stage).
So the code which some pages add is the following:
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-10969791-1');
gtag('config', 'GA_MEASUREMENT_ID', {
'custom_map': {'dimension1': 'abTestDesign'}
});
gtag('event', 'abTestDesign_dimension', {'abTestDesign': 1});
</script>
The code doesn't produce any Javascript error but it doesn't seem to be working as it shows 0 entrances, while there were at least some entrances by myself.
Where did I get this wrong? (I guess the problem is with the code).