#GTMTips: The URL Parser Variable Template For Server Containers

by datatabloid_difmmk

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

URL parser template for server container

the template is Community template gallery. To download server containerdo the following:

  1. go to template In the Google Tag Manager server container where you add the URL parser variable template.
  2. click Search gallery next to variable template box.
  3. Search for URL parser gallery template.
  4. click Add to workspace Add to container.

Add to workspace template

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 typesettingReturn value
filename extensionnonehtml
piecenonesome-hash-fragment
Full URLnonehttps://www.mydomain.com/some-path/file.html?queryParameter=parameter_value#some-hash-fragment
hostnameStrip “www.” not yet verifiedwww.mydomain.com
hostnameStrip “www.” already checkedmydomain.com
roadnone/some-path/file.html
portnonenone
protocolnonehttps
queryquery key UnsetqueryParameter=parameter_value
queryquery key set to queryParameterparameter_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.

You may also like

Leave a Comment

About Us

We’re a provider of Data IT News and we focus to provide best Data IT News and Tutorials for all its users, we are free and provide tutorials for free. We promise to tell you what’s new in the parts of modern life Data professional and we will share lessons to improve knowledge in data science and data analysis field.