Google analytics help

Discussion in 'Wordpress Support' started by Davek0974, Nov 27, 2017.

Thread Status:
Not open for further replies.
  1. Davek0974

    Davek0974 UKBF Ace Free Member

    2,597 308
    Trying to trap things being added to basket as a goal, at least i think thats what i want :)

    Looking for abandoned carts or buyers adding to cart then leaving the site.

    Is there a way to setup a goal in GA to trap this action?

    I have tried testing for "add-to-cart", "add-to-basket" in the URL but no luck.


    Any ideas??
     
    Posted: Nov 27, 2017 By: Davek0974 Member since: Mar 7, 2008
    #1
  2. Alan

    Alan UKBF Legend Full Member - Verified Business

    6,549 1,808
    You will need to trap an 'event' for add to basket ( and then use the event to record a goal but I would say you probably want to keep your goals 'clean' as sales rather than intermediate events )

    There probably (premium) are plugins for e-commerce tracking in Woo, as its a common requirements.

    see https://developers.google.com/analytics/devguides/collection/analyticsjs/events

    But you can do it with a little jQuery too e.g.

    Code:
    <script>
    $( "input[name='add-to-basket''" ).click(function() {
         ga('send','event','Woo','click','Add to Basket');
    });
    </script>
    
    tweaked & tested of course and enqueued in the right place
     
    Posted: Nov 27, 2017 By: Alan Member since: Aug 16, 2011
    #2
  3. Davek0974

    Davek0974 UKBF Ace Free Member

    2,597 308
    Hmm, ok, not as simple as i guessed :)

    I'll stick with what i have for a moment and see what i can glean from it.

    Thanks
     
    Posted: Nov 28, 2017 By: Davek0974 Member since: Mar 7, 2008
    #3
  4. Alan

    Alan UKBF Legend Full Member - Verified Business

    6,549 1,808
    Posted: Nov 28, 2017 By: Alan Member since: Aug 16, 2011
    #4
Thread Status:
Not open for further replies.