Analytics
5.6K members online now
5.6K members online now
Ask questions about filter set-up and issues with using filters in Google Analytics reports
 
Guide Me
star_border
Reply

Custom Dimension Help Using Regex

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi All,

 

I have been trying to create a custom dimension to better track existing customers for my website. The transaction id has the customer id & order id built into it when it was developed.

 

I would like to extract the customer id portion of the transaction id and place into a custom dimension.

 

example transaction id is: -

 

201707166053uFJgqlETjc16390

 

and the regex that I am using to extract the custmer id: -

 

^\d{8}(\d+).{10}\d+$

 

it should isolate the "6053" in the transaction id

 

this is how I am using the regex in the filters: -

 

 

Screen Shot 2017-07-17 at 08.40.04.png

 

I have created a simple custom report to test which uses revenue as the metric and the new customer id field but there is no data...

 

Any help is appreciated...

 

BTW, the customer id custom field has been created with Session scope.

 

1 Expert replyverified_user

Custom Dimension Help Using Regex

Top Contributor
# 2
Top Contributor

Hi :-)
Afaik filters cannot be used in this manner with custom dimensions.
The value for the custom dimension needs to be set and sent with a hit so as to populate the reports with data for the custom dimension.
http://www.lunametrics.com/blog/2015/10/16/filtering-session-user-custom-dimensions-google-analytics...


What you can do though is create a filter and use the User Defined field in the Output to -> Constructor to hold the $A1 value instead.
(there is also Custom Field 1 and Custom Field 2 as well however these are more often used for 'holding' field values before passing them to another field, when creating cascading filters)

Bronwyn Vourtis, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here

Re: Custom Dimension Help Using Regex

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Hi Bronwyn,

 

Thanks for the reply, so I have changed the filter to be like this...

 

Will this be sufficient?

 

 Screen Shot 2017-07-17 at 09.11.39.png

 

 
 

Custom Dimension Help Using Regex

Top Contributor
# 4
Top Contributor

Yes, re filter setup :-)

Provided the regex is correct, then it should all be good to go :-)

Bronwyn Vourtis, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here