First of all I am new to Google Tag Manager so apologies for my explanation.
I am trying to implement a Google Tag Manager to my website. I am not trying to use too many features but the main thing I am trying to do is load my website with a query string parameter:
Example: (: www.myweb.com?key=key&value=value)
which then I am trying to
I have added the following code:
$(document).ready(function (){
const urlSearchParams = new URLSearchParams(window.location.search);
const params = Object.fromEntries(urlSearchParams.entries());
console.log(params)
window.dataLayer = window.dataLayer || [];
dataLayer.push({params.key:params.value})
//window.dataLayer.push({"Event":"dog"})
})
I have an index.html and have added the head script and body script from google tag manager (the page is hosted online with Google Firebase). I am not sure how to send the key value to Google Tag Manager Data Layer but the main thing is when I do send it, where do I find this information on Google Tag Manager, do I need to create a variable or something on GLM ?
Thank you in advance.
Please do let me know if you require anymore information
