Skip to content

Variable Template (Server) for Google Tag Manager for splitting a string. You can split by first, last or Nth occurrence. Result can be the split result itself, complete or limited string returned.

License

Notifications You must be signed in to change notification settings

gtm-templates-knowit-experience/sgtm-split-string-variable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Split String - SGTM Variable

Variable Template (Server) for Google Tag Manager for splitting a string. You can split by first, last or Nth occurrence. Result can be the split result itself, complete string or limited string returned.

This Template is available in the Google Tag Manager Template Gallery.

Split String SGTM Variable

Delimiter

  • Type in a delimiter for splitting the string
    • To split a string based spaces in the string, type space as delimiter
  • Regular Expression splitting is not supported

Select Occurence to Return

You can split the string using the following methods:

  • First Occurrence
  • Last Occurrence
  • Nth Occurrence from Start of string
    • The first occurence is 0 when counting delimiters from the start of string
  • Nth Occurence from End of string
    • The first occurence is 1 when counting delimiters from the end of string

Enhanced Split Result

When splitting a string, only the first result is normally returned. If the-quick-brown-fox-jumps-over-the-lazy-dog is your string, and you split using - (hyphen) on First Occurence, the result returned is the.

With enhanced result settings, you can either return the complete string after the split, or a limited string.

Return Complete String after Split

If selected, the complete string after the split will be returned.

E.g. if your string is the-quick-brown-fox-jumps-over-the-lazy-dog, and you split using - (hyphen) at occurence 2, the value returned is brown-fox-jumps-over-the-lazy-dog.

Limit Complete String Returned

If selected, the complete string after the split will be limited.

E.g. if your string is the-quick-brown-fox-jumps-over-the-lazy-dog, and you split using - (hyphen) at occurence 2, and the limitation number is set to 3, the value returned is brown-fox-jumps.

About

Variable Template (Server) for Google Tag Manager for splitting a string. You can split by first, last or Nth occurrence. Result can be the split result itself, complete or limited string returned.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages