X-GEO-City with error

How do I join names by removing accentuation using the REGex table in GTM?

I use the X-GEO-City resource but the returned value has accents and spaces between one word and another

example: Belo Horizonte, should return: belohorizonte
example2: Unai, should return: unai

can you help me?

I can’t use javascript because there is no server-side option in gtm

This configuration is important for sending city location data to Facebook and the formatting must be like this (without accents, punctuation and with the addition of names)

I can’t use javascript because there is no server-side option in gtm

Hi Rodrigo,

The easiest way here is to create and use a custom variable on the server container that will do this. You can use JS in the variable (though not all of it).

there is no js variable option on the server!

Yes, you need to create custom variable and code needed logic there

Forgive my ignorance, but what would it look like to get it ready to make a js?

I need to put this js:

function() {
var str = {{Stape Location (City)}};
var parsed = str.normalize(‘NFD’).replace(/([\u0300-\u036f]|[^0-9a-zA-Z])/g, ‘’);
return parsed;

I put js in the field and it gave an error. This same code works perfectly on the web side

I need to pull this data from event data, I’m trying to do it by creating a custom template via js, but it’s giving an error

It can’t be done simply the same way on a web container. The documentation can definitely help you with writing the tag: Server-side tagging APIs  |  Google Tag Manager - Server-side  |  Google for Developers

Fala @Rodrigo. Brasil aqui rsrs

Achei teu post procurando pela mesma solução, conseguiu resolver?


You can create a template and catch the request header and process of each event and process via that.

import the request header

const getRequestHeader = require('getRequestHeader');

the define the variable from the request header that you want to use in the template.

const X-GEO-City = getRequestHeader('X-GEO-City') || '';