Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Adding something to HEAD section
I've been trying to add some google analytics to the head section of my forum, but I can't seem to get it in right. I downloaded the add-on for the old google analytics and used somebody elses's modifications to update it, but it still doesn't put the code in the head section. Here's the problem code:
$AddGoogleAnalytics = $Context->ObjectFactory->NewContextObject($Context, "AddGoogleAnalytics");
$Page->AddControl("Page_Render", $AddGoogleAnalytics, $Configuration["CONTROL_POSITION_HEAD"]);
I know that last $page command is what needs to be modified, but I'm scared to mess with it again; I crashed the forum a couple of times when I tried to modify an extension. A correction would be nice, but an explanation would be most highly appreciated.
0
This discussion has been closed.
Comments
What you actually want to do to the Google Analytics extension is remove the entire body of the if() statement and replace it with this:
$Head->AddScript('http://www.google-analytics.com/urchin.js'); $GoogleAnalytics = ' <script type="text/javascript"> // <![CDATA[ _uacct="'.$Configuration['GoogleAnalyticsAccountNumber'].'"; urchinTracker(); // ]]> </script>'; $Head->AddString($GoogleAnalytics);