Where to put Google Analytics event code in Membership plugin


I am trying to install Google Analytics events tracking for the PayPal Express with Single Payments setting. Can you tell me where I would need to put the code? onClick=”_gaq.push();” For a Google reference, see this link: https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide

Thank you for your help!

  • 3SixtyEvolve
    • New Recruit

    Hi @simplicent

    Thank you for your post and being part of our Community!

    I had a look at the ‘Event Tracking Guide’ link that you provided and noticed that before using the tracking code you need to add the ga.js code to the pages that you want to use.

    As per this link or this one:

    The Analytics snippet is a small piece of JavaScript code that you paste into your pages. It activates Google Analytics tracking by inserting ga.js into the page. To use this on your pages, copy the code snippet below, replacing UA-XXXXX-X with your web property ID. Paste this snippet into your website template page so that it appears before the closing </head> tag.

    The second step is to call the _trackEvent() method in the source code of a page object, widget, or video.

    I’m not entirely sure how you want to use _trackEvent() with PayPal Express as it seems to me that this is more related to specific objects, widgets, or videos. Please advice.

    Have a great day and look forward to receiving your feedback.


  • simpl9
    • WPMU DEV Initiate

    Hi Gina,

    Thanks for the response. I want to use the trackEvent() call on the PayPal “subscribe” button to track how many people are finishing the sign up process and moving on to PayPal’s website to check out. Make sense? I just need to know where in the Membership code that PayPal button is called.


  • aecnu
    • WP Unicorn

    Greetings Eric,

    Sorry for the delay in the reply here concerning this ticket.

    I must first take note that you are indeed several versions behind on the updates to the Membership plugin and the latest version is version 3.1.2

    Though I admit this is not related to your question here, I do want to make sure you avoid future problems and not benefit from the many fixes contained therein.

    Please update at your earliest convenience and I recommend backing up before doing it in case something goes wrong.

    Regarding this question of where to place the tracking code within membership is obviously directly related to the gateway you are using, in this case you chose PayPal in which there are a few options.

    However, all gateway coding for all types including other gateways are located in the /wp-content/plugins/membership/membershipincludes/gateways/

    That should do the job for you.

    Thank you for being a WPMU Dev Community Member!

    Cheers, Joe

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.