Tips and Tricks HQ Support

Support site for Tips and Tricks HQ premium products

  • Home
  • Contact Us
  • Documentation
  • Forum Home
    • Forum
    • Forum Search
    • Forum Login
    • Forum Registration

WP Affiliate – Track sign ups with Google Analytics Goals?

by

Tips and Tricks HQ Support Portal › Forums › WP Affiliate Platform › WP Affiliate – Track sign ups with Google Analytics Goals?

Tagged: analytics, Google, Google Analytics Goals, tracking

  • This topic has 16 replies, 3 voices, and was last updated 10 years, 2 months ago by Ralph12.
Viewing 15 posts - 1 through 15 (of 17 total)
1 2 →
  • Author
    Posts
  • February 14, 2015 at 3:35 pm #12213
    Ralph12
    Member

    I’d like to track sign up conversions via Google Analytics Goals. The Affiliate plugin is embedded using the shortcode and it seems there’s no post-signup thank you page URL to use in Analytics Goals.

    How to go about setting up a GA Goal for Affiliate Platform sign ups tracking?

    Thank you :)

    February 14, 2015 at 5:45 pm #68599
    wzp
    Moderator

    I know we are discussing Affiliate Platform, but does this eStore & Google Analytics Goals thread help?

    https://support.tipsandtricks-hq.com/forums/topic/any-way-to-track-clicks-for-wpestore

    February 15, 2015 at 1:25 am #68600
    admin
    Keymaster

    You will know exactly how many people signed up by checking your affiliates admin (it tells you the total number of affiliates that signed up). What are you trying to achieve with the goal?

    If I know your requirement better, I should be able to help.

    February 16, 2015 at 5:03 pm #68601
    Ralph12
    Member

    I’d like to set up a GA goal for sign ups, as this will allow me to easily track stats like the visitors vs. sign ups ratio. Such stats would help me to track the effectiveness of marketing efforts promoting my affiliate program.

    Here are my 2 cents:

    Maybe signups can be tracked as an event via a GA goal, just like contact form 7 does: http://www.astralwebinc.com/contact-form-7-wp-how-to-add-event-tracking-on-new-universal-google-analytics/

    A checkbox could then be added to Affiliate Platform’s admin area, (de)activating the event code line after a sign up. The event values (Category, Action, Label, Value) that GA needs, could be written near the checkbox. So users can simply copy/paste these values to the GA event goal’s settings.

    Here’s more info re the above idea: https://developers.google.com/analytics/devguides/collection/analyticsjs/events

    Not sure whether this will work though.

    February 17, 2015 at 11:47 am #68602
    Ralph12
    Member

    I’m thinking of adding the following code to functions.php:

    <?php
    function add_goal_conversion_tracking() {
    if (is_page('PAGE_ID_AFF_SIGNUP_FORM')) {
    ?>
    <script>
    (function($) {
    $(window).load(function() {
    $('#regForm button[type="submit"]').on('click', function() {
    ga('send', 'event', 'Affiliate Signup Form', 'signup', 'form', 1);
    });
    });
    })(jQuery);
    </script>
    <?php
    }
    }
    add_action('wp_footer', 'add_goal_conversion_tracking');
    ?>

    What do you think of the above code?

    February 17, 2015 at 11:28 pm #68603
    admin
    Keymaster

    That looks good to me. Add in some “alert” statements in there when you are testing to make sure the code is executing as you think it should.

    February 18, 2015 at 6:36 pm #68604
    Ralph12
    Member

    Thanks for shedding your light on it! Initially I just assumed that the code would work, but because of your post I figured I better do some proper testing. And I quickly found out that GA was not tracking anything. Here’s why:

    I use the ‘Google Analytics by Yoast’ plugin to insert the GA Universal code and it defines ‘__gaTracker’ instead of the standard ‘ga’. So, after replacing:

    ga('send', 'event', 'Affiliate Signup Form', 'signup', 'form', 1);

    With:

    __gaTracker('send', 'event', 'Affiliate Signup Form', 'signup', 'form', 1);

    GA started tracking the signup button clicks as events/conversions.

    Also, a great way to test any event/goal tracking code, is via GA’s real-time reporting feature. Here’s how to do this:

    Login to GA > Reporting tab > Real-Time > Events and Conversions. Make sure to not filter your own traffic and you’ll be able to see real-time, whether button clicks and form submissions are being tracked. For reference: https://support.google.com/analytics/answer/1008083?hl=en

    Hope the above helps someone :)

    Thanks again guys,

    Ralph

    February 19, 2015 at 1:12 pm #68605
    Ralph12
    Member

    The tracking code described in this topic is triggered each time the signup button is clicked. Because of this GA still registers a conversion, even when the form is invalid. The ideal situation would be to only register a conversion when the form submission is valid.

    Do you perhaps know how to trigger the tracking code, only when the signup form submission is valid? Maybe a check which checks whether the validation script outputs errors? Or does this require modding WP Affiliate Platform’s core code?

    February 19, 2015 at 1:55 pm #68606
    wzp
    Moderator

    The tracking code described in this topic is triggered each time the signup button is clicked. Because of this GA still registers a conversion, even when the form is invalid. The ideal situation would be to only register a conversion when the form submission is valid.

    The solution would be to move the code to a page that is only viewed once, and only when the submitted form is valid; sort of like a Thank You page for successfully signing up. I’m not sure such a page currently exists, so a slight bit of custom coding mght be required.

    February 19, 2015 at 3:42 pm #68607
    Ralph12
    Member

    Ok, thank you for clearing things up! It would be great if a future version of Affiliate Platform had a similar feature as Contact Form 7: http://www.astralwebinc.com/contact-form-7-wp-how-to-add-event-tracking-on-new-universal-google-analytics/ :) The described CF7 feature only triggers the tracking code, when a form submission is valid.

    February 20, 2015 at 12:12 am #68608
    admin
    Keymaster

    I will add a filter that you can use to output some code just below the “affiliate registration success” message. That way, it will only get executed after a successful registration.

    February 20, 2015 at 10:32 am #68609
    Ralph12
    Member

    Thanks, sounds good to me!

    February 21, 2015 at 2:35 am #68610
    Ralph12
    Member

    Not sure whether you’ve already added the filter, but it seems I did find something that might work… it has only been tested with an ‘alert’. Apparently the Validation Plugin can work with checks like this:

    if ($('#regForm').valid()) {

    The complete tracking code with the check implemented (should only track valid form submissions):

    <?php
    function add_goal_conversion_tracking() {
    if (is_page('PAGE_ID_AFF_SIGNUP_FORM')) {
    ?>
    <script>
    (function($) {
    $(window).load(function() {
    $('#regForm button[type="submit"]').on('click', function() {
    if ($('#regForm').valid()) {
    ga('send', 'event', 'Affiliate Signup Form', 'signup', 'form', 1);
    }
    });
    });
    })(jQuery);
    </script>
    <?php
    }
    }
    add_action('wp_footer', 'add_goal_conversion_tracking');
    ?>

    Could you please let me know what you think of this approach / the above code?

    February 22, 2015 at 1:45 am #68611
    admin
    Keymaster

    yeah that should work also.

    I have added a filter but I still need to do some testing on it before I can give it to people.

    February 24, 2015 at 12:49 pm #68612
    Ralph12
    Member

    Okay, I’ve tested the check and it does indeed prevent the tracking of invalid forms. However, it seems it works a bit too good… valid forms, that never had any errors, are always being tracked correctly. But valid forms that have fixed validation errors, are only being tracked after ‘unfocusing’ (by clicking somewhere else on the page) the fixed form fields. Seems the ‘unfocus’ click is required in order to properly reset the validation status of the form. Whatever the cause; unfortunately the check is not 100% reliable (never tracks invalid signups, but it might miss some valid signups as well).

    All in all I believe your filter approach is the way to go. Please let me know if I can help with the testing.

  • Author
    Posts
Viewing 15 posts - 1 through 15 (of 17 total)
1 2 →
  • You must be logged in to reply to this topic.
Log In

Forum Related

  • Forum Home
  • Forum Search
  • Forum Registration
  • Forum Login

Support Related Forms

  • Contact Us
  • Customer Support
  • Request a Plugin Update
  • Request Fresh Download Links

Useful Links

  • Plugin Upgrade Instructions
  • WP eStore Documentation
  • WP eMember Documentation
  • WP Affiliate Platform Documentation
  • Tips and Tricks HQ Home Page
  • Our Projects

Quick Setup Video Tutorials

  • WP eStore Video Tutorial
  • WP eMember Video Tutorial
  • WP Affiliate Platform Video Tutorial
  • Lightbox Ultimate Video Tutorial

Our Other Plugins

  • WP Express Checkout
  • Stripe Payments Plugin
  • Simple Shopping Cart Plugin
  • Simple Download Monitor

Copyright © 2025 | Tips and Tricks HQ