Set Google Analytics UA dinamically

Silver Contributor
Silver Contributor
Dear, Is it possible to set a different UA to a single GA tag in an extension (or similar) depending on the domain of a page? How could you do so? Thanks a lot in advance.
1 REPLY 1

Set Google Analytics UA dinamically

Employee Emeritus
Hi Martin, There may be some nuance on this based on your deployment (are there separate tracker names involved for instance?) but very simply, in the case where there is only one other UA account id to deal with you could use the Set Data Values extension (https://community.tealiumiq.com/posts/554049) to set a data source -- let's call it ga_acct_id -- to the appropriate value based on the domain and then map ga_acct_id to the Account (Default Override) destination in your GA tag. If there are multiple domains in play then you would probably want to use the Lookup Table extension (https://community.tealiumiq.com/posts/541621) to set ga_acct_id. For either scenario, you would want to scope the extension to the GA tag. Hope that helps.
Public