OJS 2.4.8.1 Scope of $currentJournal in smarty templates

Hello,

I’m trying to include some javascript in /lib/pkp/templates/common/header.tpl but only for one Journal. I am currently doing

	{if $currentJournal && $currentJournal->getId() == 1}
		<!-- Global site tag (gtag.js) - Google Analytics -->
		<script async src="https://www.googletagmanager.com/gtag/js?id=UA-xxxxxxx-1"></script>
		<script>
		  window.dataLayer = window.dataLayer || [];
		  function gtag(){ldelim}dataLayer.push(arguments);{rdelim}
		  gtag('js', new Date());

		  gtag('config', 'UA-xxxxxxx-1');
		</script>
	{/if}

It is mostly working on all pages except for Article Views. For some reason, $currentJournal doesn’t seem to be available there. Is there a better way I can handle this? It does seem to be working on any other page/view I’ve tried.