• Resolved Jonathan Stegall

    (@jonathanstegall)


    I’m looking for a way to add additional dimensions that I already have in Analytics. I noticed that a previous version had a hook: ga_dash_addtrackingcode (I found it mentioned here) that has been deprecated (as mentioned here) in favor of other hooks.

    Can you clarify if there is still a way to add a new dimension (for example, if I need to add the post type, or a custom user meta value to an existing Analytics dimension) via this plugin, and if so how that can be done?

Viewing 1 replies (of 1 total)
  • Hi,

    Yes it is possible, here’s an example:

    <?php
    /* Analytics Code */
    function gadwp_addcode( $gadwp ) {
    	$commands = $gadwp->get(); // Get commands array
    	
    	array_pop( $commands ); // Pop the last element
    	
    	$fields = array();
    	$fields['hitType'] = 'pageview';
    	$commands[] = $gadwp->prepare( 'send', $fields ); // Add a new line to the commands array
    	
    	$gadwp->set( $commands ); // Store the new commands array
    }
    add_action( 'gadwp_analytics_commands',  'gadwp_addcode', 10, 1 );
Viewing 1 replies (of 1 total)
  • The topic ‘Documentation for hooks, especially adding custom dimensions?’ is closed to new replies.