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 html to php pages



  • Thanks heaps both of you! Amazingly prompt! This forum continue to surprise & please that members are so willing to help and you can get so much info.

    I had expected to physically add code to pages, and had no idea an extension/add-on was so easy (if you know how). I'll give it a try, and try to understand fully later.
  • ithcyithcy New
    edited September 2006
    glad to help :)
    just checked out the above add-on at my own forum and it works OK for me.
  • one caveat: (this is a personal preference of course)

    you might want to go into your analytics settings (on, not in that extension) and change it a little:
    under Profile Settings->Main Website Profile Information, edit the Exclude URL Query Parameters field so that it says "page, PostBackAction" - just so you don't get a lot of different kinds of hits for what is really a request for the same page.

    for example a request for this:

    is really the same as a request for this:

    and this:

    but you really only care about hits on that thread, not on each of the individual pages or when people save settings. so all you want is the "DiscussionID" part of the url - you want google analytics to ignore the "page" and "postbackaction" parts.

    sorry if this is not clear, i didn't explain very well.
  • i uploaded it to add-ons - here.

    dinoboff, i credited you as the author in the source. i know you're thrilled.
  • of course i am :-P
  • Hey guys, I just need a little more help please.

    I have just (finally) upgraded to 1.01 (from tonight. I chose the add-ons I wanted, including Google Analytics and uploaded about a dozen to my site. But I had 2 problems .....

    (1) Vanilla didn't list Google Analytics in the Extensions list under settings. I'm assuming this was because it wasn't in the form of /Extension name/default.php. I put it in a folder as required - should I just change the name of the file to default.php?

    (2) There didn't seem to be a save button on the Extensions page in Settings, but that is a separate problem.
  • ithcyithcy New
    edited September 2006
    just download the one from the addons site. yes, it does have to be named default.php inside a folder.

    there is no save button because it's all done through ajax. the save happens invisibly when you click a checkbox.
  • I get this error when trying to preview my message:

    Fatal error: Call to a member function on a non-object in /home/console/public_html/engineersvoice/extensions/GoogleAnalytics/default.php on line 17

    Line 17 looks like pointing to this line in the default.php

    Any solutions to this problem?
  • ithcy, thanks for your patience, can i bother you one more time please? i have succesfully downloaded and installed now thanks - it was just stupidity on my part that prevented your extension appearing in the list of extensions the first time. and the failure to save was a permissions problem - the documentations says they are the biggest source of problems, and I had missed one - so that is also now cool. i just wanted to check about your advice about "page, PostBackAction". i understand what you are getting at, and I agree that i don't want all these extra "hits" recorded. but i am unclear about how i do that. at present i do not record my own hits - i exclude these by using a filter. i presume you are suggesting another filter? from the choices open to me, it must be a custom filter, and the two main options i need to choose are: filter field - chosen from a list of a whole range of fields (e.g. page title, visitor country, etc) filter pattern - this is blank and i have to fill in so, can you expand your advice any further please to what i should enter to exclude the things you have suggested? or am i in the wrong section of google analytics?? thanks again
  • tthmaz: check out this thread or just download the updated google analytics add-on.

    ercatli: glad you got it sorted out. you are in the wrong section of google analytics. make sure you're in Profile Settings->[Main] Website Profile Information, and you're looking for the field called "Exclude URL Query Parameters" exactly.
  • easier to show than tell:



  • ithcy, you're a legend! thanks heaps! they say a little knowledge is dangerous, and that's my problem. i'm just learning all this stuff as i go along, so i know enough to attempt some of these things, but not enough to complete them successfully. but i can see i'm going to have to read a bit more about php. i'm also amazed at how much there is to google analytics, although a little disturbed to find what appear to me to be certain erros in the stats they provide. i just hope the stuff i'm mainly using is ok. thanks again.
  • I have a suggestion. Wouldn't it be better to place the analytics code at the bottom of the HTML codes? From what I can see, this addon adds it at the top, while another addon (sidepanel)add it at the panel, where both can be an disadvantage since google analytic can be slow in collecting data from a visitor and the page won't continue loading b4 it finishes collecting data, which can be a bad thing for visitors.

    Any comments?
  • the page won't continue loading b4 it finishes collecting data

    are you sure about this? how do you know? if it's true, i'll move it to the end of the page.
  • Hi itchy,

    Had the same experience with 2 of my sites.

    For example, if i use this addon, sometimes only the header will be loaded while analytics is still collecting visitor's data. As for sidepanel addon, you may only see the header and the panel. Placing the code at the end (footer) at least loads up the full page b4 analytics collects data.

    Yeah,I'm sure of this :) Cheers!
  • ithcyithcy New
    edited September 2006
    ah, you're absolutely right. i missed this part on the google analytics page:
    "It [the urchin script] should be immediately before the </body> tag of your page"

    i'll change the addon.
  • ok, the extension is updated. thanks for the alert, tthmaz.
  • Nicely done, Itchy!
  • ithcy

    I'm afraid I'm still having a bunch of problems with Google Analytics. I am getting inconsistent recording of visits when I test, and it is difficult to isolate whether it is because of a fault in GA or at my end. Could you help me please by explaining a little more what the "page" and "PostBackAction" achieve? My understanding is that:

    (1) If a thread goes over onto a second page, the two pages have the same ID number, but a page number is added to the title, so we exclude the "page" from what is recorded, so GA sees them both as the same - is that right? But won't it still record it as two hits, just the same page visited twice??

    (2) I don't understand "PostBackAction" at all, but I think it has something to do with Vanilla responding to some input, and I guess you're wanting to lump the input and the resonse together. But again, won't that still give 2 "hits", just on the same page?

    I'll do some more testing today, and get back to you again if I may if I have any more questions (hope that's OK?). I originally only wanted simple statistics, and thought GA would be easier than Slimstat or Shortstat or Statcounter or whatever, but now I'm enmeshed in it, I want to try to get it right before I give up. Thanks.
  • ithcyithcy New
    edited September 2006
    you're absolutely right. it will count as multiple hits on the same discussion.
    i just don't like having a really long list of page hits like this in my stats:
    and repeat for each discussion, when they're all really just hits to the same thread. i only care about the hits per discussion, not per discussion and also per page and also per PostBackAction. you might need more granularity than i do.
This discussion has been closed.