Server-side tagging allows any kind of HTTP request to be sent to the server container. The Server container parses these and launches container instances to send data to first party data stores and third party vendors alike.
These requests often contain a URL string encoded with query parameters. A typical example is document location Parameters for Universal Analytics requests.
server side client Parse these URL strings and convert them to the required format. event data object.
If one of the fields in the event data object is page_location
, which typically encodes the URL of the page from which the request originated. Parsing this field is difficult without a dedicated variable template, so URL parser A variable template for the server container.
The variable template user interface is URL variables Built into GTM’s web container. The main difference is that URL source From the beginning.default is page_location
Fill in the fields, but you can provide a valid URL string from any source (such as other parameters of an incoming HTTP request).
X
shimmer newsletter
Subscribe to our Simmer newsletter to receive the latest news and content from Simo Ahava right in your email inbox!
Tip 125: Server container URL parser variable template
the template is Community template gallery. To download server containerdo the following:
- go to template In the Google Tag Manager server container where you add the URL parser variable template.
- click Search gallery next to variable template box.
- Search for URL parser gallery template.
- click Add to workspace Add to container.
After successfully adding it to your workspace, you can navigate to: variable Click to create a new variable. For variable types, URL parsermust be listed among the available custom templates.
The variable itself is URLs Variables in the web container.
for example, page_location
If the event data field is set to this URL string, the following table shows the possible return values for the variable depending on what you choose in the options.
https://www.mydomain.com/some-path/file.html?queryParameter=parameter_value#some-hash-fragment
Component type | setting | Return value |
---|---|---|
filename extension | none | html |
piece | none | some-hash-fragment |
Full URL | none | https://www.mydomain.com/some-path/file.html?queryParameter=parameter_value#some-hash-fragment |
hostname | Strip “www.” not yet verified | www.mydomain.com |
hostname | Strip “www.” already checked | mydomain.com |
road | none | /some-path/file.html |
port | none | none |
protocol | none | https |
query | query key Unset | queryParameter=parameter_value |
query | query key set to queryParameter |
parameter_value |
We hope you found the template helpful. A primary use case is to extract query parameters such as ad click IDs (think of it). fbclid
, gclid
), decorating the tag’s outgoing payload with this metadata.