WordPress.org

Ready to get started?Download WordPress

Forums

AddToAny and Google Analytics (1 post)

  1. andreand
    Member
    Posted 2 years ago #

    Hi there,

    I installed AddtoAny share button in my blog, and works fine.

    Do you use this button? Do you like it? Do you track it from Google Analytics?

    I can't get tracking the events of AddToAny in GA.

    It seems that the instructions there are different from the instructions in WP, I mean, I copied this code into my index.php:

    <?php if( function_exists('ADDTOANY_SHARE_SAVE_KIT') ) { ADDTOANY_SHARE_SAVE_KIT(); } ?>

    from WP instructions:
    http://wordpress.org/extend/plugins/add-to-any/faq/

    And someone has just suggested me that I should use this code in order to track this event on GA:
    http://www.addtoany.com/buttons/customize/events

    <a class="a2a_dd" href="http://www.addtoany.com/share_save">
        <img src="http://static.addtoany.com/buttons/share_save_171_16.png" border="0" alt="Share"/>
    </a>
    
    <span id="events_demo"></span>
    
    <script type="text/javascript">
    // A custom "onReady" handler for AddToAny
    function my_addtoany_onready() {
        events_demo.innerHTML = 'AddToAny menu is ready!';
    }
    
    // A custom "onShare" handler for AddToAny
    function my_addtoany_onshare(data) {
        events_demo.innerHTML = 'Shared &quot;<a href="'
            + data.url
            + '">'
            + data.title
            + '</a>&quot; to '
            + data.service
            + '!';
    }
    
    // Setup AddToAny "onReady" and "onShare" callback functions
    var a2a_config = {
        tracking_callback: {
            ready: my_addtoany_onready,
            share: my_addtoany_onshare
        }
    };
    </script>

    Ops! I don't know how to match the special code for WP with this code.

    It's required to track the button ...

    How can help me, please?

    Do you use this button? Do you like it?

Topic Closed

This topic has been closed to new replies.

About this Topic