Search code examples
google-tag-manager

How can I make a tag run before others tags in google tag manager?


I Create a Tag in google tags manager and make it custom_html and bun a javascript function code inside and i use the function inside another tag But after I publish it it says fbq_custom() not define but when I open the gtm file i can see it there

I think the problem that with Priority, so how can i force the function to run before other tags ?


Solution

  • There are a few ways to do it. Like pushing an event that you're listening to after you define the function and on that event, you execute your custom HTML tag.

    A more elegant solution would be using tag sequencing function in GTM: enter image description here