Forums

Google Analytics on multisite subfolder (4 posts)

  1. noobbgodlike
    Member
    Posted 10 months ago #

    I have successfully install multisite subfolder, but what I do need to do now so I can track new section?? Because The new site (guide4gamers.com/3ds) didn't got tracked by analytics. Do I need to put the same code in header.php on themes that I use(I use different themes on new multisite)??

    Or do I need to create a new profile in my google analytics account??

  2. Andrea_r
    team pirate
    Posted 10 months ago #

    this would be the easiest way to track all your sites with one GA code.

    http://wpmututorials.com/plugins/how-to-hook-into-the-footer/

  3. noobbgodlike
    Member
    Posted 10 months ago #

    hmm Is this code correct?

    <?php
    
    /* google analytic for all subfolder site */
    
    /*
    Plugin Name: GA subfolder
    Description: analytic tracking code
    Author: noobbgodlike
    Version: 1.0
    Author URI: www.guide4gamers.com
    */
    
    function GA_SUBFOLDER () { ?>
    
    /* TRUE or NOT^^^^^. */
    
    <p><em>This blog is provided by <a href="<?php get_settings
    
    ('www.guide4gamers.com'); ?>"><?php get_settings('guide4gamers'); ?
    
    ></a>.</em></p>
    
    /* site url is main site,isn't it ?? what about sitename?, is it case sensitive or anything? */
    
    <?php }
    
    /* We opened up our php again. we have to tell WPMU something important. */
    add_action('wp_footer', GA_SUBFOLDER');
    
    /* Now, Where I put my google analytics code?? Thank you Andrea */
    ?>

    I don't have 2500 subfolder maybe only about 3-5. :D. Which tracking code that I need to use?? (Single domain, one domain with subdomain, multiple top level domain??Sorry if this sound stupid, probably the answers is single domain but just wanna to make sure ..T T)

    Where do I need to put this code (IN PLUGIN FOLDER??)??How to create thht .php file?? (Am I only need to rename the .txt file into plug-in.php).What I should name the plug in?? Is it must be the same as function name?GA_SUBFOLDER.PHP?? or what?

  4. Ipstenu
    Half-Elf Support Rogue & Mod
    Posted 10 months ago #

    Put the file into your mu-plugins folder -- if you don't have one, it's a folder named 'mu-plugins' in the same level as your plugins folder - you get this:

    wp-content\plugins
    wp-content\mu-plugins
    wp-content\themes

    As for your code, you're on the right track :) The siteurl stuff actually is putting WP data, so you keep those as is IF you want them. If not, just put your GA code where I put the [GOOGLE CODE HERE!] thing :D Replace that.

    function GA_SUBFOLDER () { ?>
    
    <p><em>This blog is provided by <a href="<?php get_settings('siteurl'); ?>"><?php get_settings('sitename'); ?></a>.</em></p>
    
    [GOOGLE CODE HERE!]
    
    <?php }
    
    add_action('wp_footer', GA_SUBFOLDER');
    
    ?>

Reply

You must log in to post.

About this Topic