Considering the script tag should be a tag I have deleted the script tags from the code but nothing is changing and isn't working.I have this tag in the menu component because I want to add it in all pages and not adding using Head Assets.Is this possible?",
"author": {
"@type": "Person",
"name": "unicodes",
"image": "https://cdn.discordapp.com/avatars/1117897194134052925/c82b3fa769ed6e6ffdea579381ed5f5c",
"url": "https://discordapp.com/users/1117897194134052925"
},
"datePublished": "2025-03-10T22:29:45.91+00:00"
},
{
"@type": "Comment",
"text": "It says “google url”",
"author": {
"@type": "Person",
"name": "Andreas Møller",
"image": "https://cdn.discordapp.com/avatars/282143925291057163/2b00be4ec537a0305354613c036a2fcd",
"url": "https://discordapp.com/users/282143925291057163"
},
"datePublished": "2025-03-14T05:38:06.03+00:00"
},
{
"@type": "Comment",
"text": "Hi Andreas,I changed the values because I want to keep the data \"safe.\"My question is: how can I use the Considering the script tag should be a tag I have deleted the script tags from the code but nothing is changing and isn't working.I have this tag in the menu component because I want to add it in all pages and not adding using Head Assets.Is this possible?"
}
I added this code but isn't working. <script async src="google url"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-4534543543543'); </script> Considering the script tag should be a tag I have deleted the script tags from the code but nothing is changing and isn't working. I have this tag in the menu component because I want to add it in all pages and not adding using Head Assets. Is this possible?
Andreas Møller
1 year ago
It says “google url”
unicodes
1 year ago
Hi Andreas, I changed the values because I want to keep the data "safe." My question is: how can I use the <script> tag to add a Google Tag? Currently, I have installed the Google Tag by adding it to the Head assets of each page, but it would be much easier to include it in a component and have it applied to all pages. I know that using the <script> tag will place it in the body rather than the head of the page, but I would be interested in trying it to see if it works. If not, having such a tag for the head as well would make things much easier. Currently, the head assets are functional but not practical.
unicodes
1 year ago
What I mean by "practical" is that removing or editing information requires checking each page individually instead of making changes in a single place / component.
Lucas G
1 year ago
Tags in components work for me. It’s how I use them on my main site
unicodes
1 year ago
@Lucas G can you please share a screen how you added them?
And if Tag Assistant doesn't see it, it means that isn't working.
unicodes
1 year ago
I'm curios how you added the code in the script tag, maybe I'm doing something wrong.
Lucas G
1 year ago
What do you mean it worked for you?
Are you seeing data in console?
For the script you posted, it's a 2 part thing so you'll need to configure each one
Lucas G
1 year ago
The second one is just a matter of pasting in the body of the script in a script tag
The other one you need to set the src via an attribute
Should just work
Lucas G
1 year ago
Is this how tag manager tags look like now
unicodes
1 year ago
I tried to add the script in this way, or just {src="google url"} and then { window.dataLayer = window.dataLayer []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-4534543543543');}but isn't working for me.
Lucas G
1 year ago
If you look at the script tag, it's inside the first bracket
Meaning it is an attribute
Not body
unicodes
1 year ago
Forget about Attributes 😅
Now make sense to me 🥰
Lucas G
1 year ago
The other one was likely setup correctly. window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-4534543543543');
unicodes
1 year ago
and in the text editor you just add { window.dataLayer = window.dataLayer []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-4534543543543');} right?
Right! Thank you Lucas!
👍1
This is why Toddle isn't "No Code" but a developer's tool 😅, you don't have to forget the rules.
Airmax
1 year ago
Just wanted to share this screen here, as I needed some time to get the analytics and gtag working. hope it helps.