Ghost code injection fine tunning for Google Tag Manager


#1

Hey all,

Just a quick idea on the Ghost code injection, in relation to Google Tag Manager:

  • does it make sense to add a section of code injection also right after the opening tag?
  • the idea is that the standard Google Tag Manager implementation requires a two part tracking code to be inserted (one in header and one in body)
  • I know it’s kind of a single exception, but it would allow for much more flexibility as all other tags could be fired through GTM and would make the Ghost code injection cleaner

Thanks!


#2

Also, for post injection, I know there is the option to inject something different in every post, but I also think that a global before/after post (not just header/footer) injection would be useful as well (especially for those wanting to monetize their Ghost blog/publication in any way).


#3

All your problems can be solved by modifying the theme. I don’t think a code injection right after the opening tag would be useful. Simply edit your default.hbs and put your code in there, after <body>. For global before/after post you can edit post.hbs and inject the desired code in there. No need for extra fields in Ghost admin.


#4

By the same token neither the current code injection feature isn’t useful as any code can be added to the theme files. :wink:

While I agree with you, I think that for non tech users an option in the admin is useful as it reduces the required theme hacks.


#5

And reduces issues that can arise from theme updates or ghost updates. The more vanilla, the easier.