r/PHPhelp • u/larsnielsen2 • Jul 06 '25
Add Google Analytics to phpdoc generated html
I have a project where I generate some phpdoc files I would like to host public. But how can I modify the template to add google analytics script tag?
4
Upvotes
2
u/LiamHammett Jul 06 '25
What tool are you actually using to generate the HTML, for one?
1
u/GrouchyInformation88 Jul 06 '25
I’m confused. What do you mean by phpdoc files, are you talking about php files or are you specifically talking about phpdoc?
If it’s just a php file that generates html, then you can simply echo the GA code.
But I’m probably misunderstanding something.
1
u/P4nni Jul 07 '25
Based on your previous comments, I'm assuming you're using phpDocumentor to generate HTML from PHPDoc.
Having a quick look at the phpDocumentor documentation, you should be able to add custom HTML by extending the template or writing an extension:
(Be aware that there might be better/easier ways to do this)