Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • robbluther Friend
    #159613

    I am trying to figure out the best way to get my analytics code in the Droid template. I am new to the templates so am not sure where the best place is to put the code.

    Thanks!

    robbluther Friend
    #374904

    Hooks.php… figured it out in case anyone else is looking 🙂

    Saguaros Moderator
    #375118

    1) yes, you try finding an extenions on the JED which help you using the GA service without modifying code in the php file, you will not influence the site when you need upgrade.

    2) Or you Should use the Custom HTML module and put GA Code into the module’s content, then you enable the module on the footnav position
    3) If you wish to hard code, you copy the file: pluginssystemjat3jat3base-themesdefaultblocksfooter.php to the templates/ja_droid/blocks/ folder and you put GA Code at end of the file

    Thanks

    bgies Friend
    #375217

    Suggestion # 2 (which would be my preferred solution) does not work with ja_portfolio and J 1.6 Script tags are stripped whether you are using No Editor, TinyMCE or Code Mirror.

    As Google Analytics is the most widely used tracking for websites, shouldn’t the templates have a text field that we can simply copy and paste the JavaScript into when setting up the template? Maybe with the choice to put the JavaScript just before the </head> tag or at the bottom of the body of the page so it can handle the new or old way.

    If you haven’t considered doing this, can I make a request that it be built into the T3 Framework. It would make using your templates much more user friendly.

    I don’t like the idea of hardcoding it, but I will go with option 3 for now.

    <em>@tienhc 219397 wrote:</em><blockquote>1) yes, you try finding an extenions on the JED which help you using the GA service without modifying code in the php file, you will not influence the site when you need upgrade.

    2) Or you Should use the Custom HTML module and put GA Code into the module’s content, then you enable the module on the footnav position
    3) If you wish to hard code, you copy the file: pluginssystemjat3jat3base-themesdefaultblocksfooter.php to the templates/ja_droid/blocks/ folder and you put GA Code at end of the file

    Thanks</blockquote>

    Phill Moderator
    #375221

    You have a few options. First is the method of putting them in a module. Contrary to popular belief, J1.6 will not strip the tags away if you set it up properly. J1.6 has a new feature called filters. It allows you to specify exactly what tags each user can or cannot use in their articles/modules. From the article manager click on the options button (the double light switch icon near the top right). You will see a number of tabs in the popup box one of which is marked “Text Filters”. It is quite self explanatory but a good start is to switch administrators and super users to no filtering and voila, your tags will bot get stripped.

    However, I would use either on of the plugins that allow you to insert analytics or use the following method.

    Copy the file plugins>system>jat3>jat3>base-themes>default>page>default.php into templates>ja_droid>page>default.php and insert your analytics code just before the </head> tag as per below.

    <head>
    <?php //gen head base on theme info
    $this->showBlock ('head');
    ?>
    <?php
    $blocks = T3Common::node_children($this->getBlocksXML ('head'), 'block');
    foreach ($blocks as $block) :
    $this->showBlock ($block);
    endforeach;
    ?>

    <?php echo $this->showBlock ('css') ?>
    ************YOUR ANALYTICS CODE HERE*************
    </head>

    bgies Friend
    #375224

    Well.. I actually don’t have a problem getting it done… I write Joomla extensions and I have my own server so I have full access. After I wrote my post, I actually used the Custom HTML method, but just inserted the JavaScript directly into the database so I didn’t have to worry about the editor stripping it. It was quick and easy. Took all of about a minute, and I already had the Custom HTML module set up. I just have to remember not to save it in Joomla if I ever need to open the module again.

    My suggestion is for normal users that don’t have my setup or programming skills.

    Putting the Analytics code into Articles is a really bad idea… You’d have to put it into every one to be sure it was there, and then you would have multiple copies on most pages. The code belongs either in the template so it shows on every page, or in a module (or template position) so you can select the pages (several other ways also, but for a normal user this would be easy). You don’t have the text filtering option for modules, so using the Custom HTML module will not work for most users.

    I could write a module or plugin to do it and I’m sure there will be one for J 1.6 soon, but I really think the template should have it built in. No idea what percentage of your template users use Google Analytics, but my guess is it’s fairly high.

    Anyway… I’m not being negative… It doesn’t bother me too much whether you have it or not… but I am a business person and programmer, and it would be a very good usability feature for your templates, so I hope you consider adding it. From reading your forums it is a FAQ.

    Phill Moderator
    #375225

    Yes, the text filtering does switch off for modules too when you switch it off for the articles.

    I too would not put it in articles (I meant to write module but for some reason the wrong word came out of my head probably because I was looking at the filters at the time), I would just use the code method used above. But you can put it in a module (like in the debug piosition set for every page) should you so desire. I do think for a while the filtering will confuse a lot of users.

Viewing 7 posts - 1 through 7 (of 7 total)

This topic contains 7 replies, has 4 voices, and was last updated by  Phill 13 years, 9 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum