How one can track query parameters in Url using Google Tag Manager?

2,040 views
Skip to first unread message

dheeraj singh

unread,
Jul 4, 2015, 10:26:51 PM7/4/15
to google-tag-mana...@googlegroups.com
How one can track query parameters in Url using Google Tag Manager?

Chris Shimmin-Vincent

unread,
Jul 21, 2015, 8:50:22 AM7/21/15
to google-tag-mana...@googlegroups.com
You would need to add some JavaScript to pass variables to the data layer as in https://support.google.com/analytics/answer/6223390?hl=en

You will notice that the following has been added:

var tripPrice = document.URL.match(/price=([^&]+)/)[1]

Chris

Lauren Ancona

unread,
Jul 24, 2015, 2:02:33 AM7/24/15
to Google Tag Manager Fundamentals, singhdh...@gmail.com
This is available as a custom variable.

Under Variables, scroll down to 'User Defined Variables' at bottom and click 'New'.

Then select the 'URL' box, and on the next screen choose "Query." Set query parameter if desired. This will capture the query string of the current page, you can add is a variable where needed.


Reply all
Reply to author
Forward
0 new messages