Anyone dealing with Measurement Protocols / CRMs will always need ClientID for tasks like sending offline transactions, managing leads/ refunds etc.. so that an exact user is matched with associated hit /record.
Searching the web I found 3 ways to fetch the client using GTM, both have same procedure but different CustomJs variable.
Recommended implementation Method, Refer blog post by Simo Ahava. Here you have to add GA code as custom HTML and send ClientID as data layers.
This on is actually not a recommended method as it uses GA cookie settings which might change in future without warning. Custom JS variable that we use here is as below. To start, create a custom Js VARIABLE named >> gacid
var match = document.cookie.match('(?:^|;)\\s*_ga=([^;]*)');
var raw = (match) ? decodeURIComponent(match) : null;
match = raw.match(/(\d+\.\d+)$/);
var gacid = (match) ? match : null;
Now we are almost done, what remains is to send this data to Google Analytics. As usual, many of us will send this a custom dimension or metrics or both.
You can also extract cookie details directly from cookie variable too. Read this blog post.
So, we are done. If you like to have a GA Realtime Analytics TEST then have it, I tested sending an event whenever page is loaded as below: