Divi WordPress Theme
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

WordPress fix Tag Google twice in cart page

Discussion in 'Misc WordPress Requests' started by francescoci, Mar 3, 2018.

  1. francescoci

    Guest

    Tag Google twice in cart page, by francescoci

    Hi,

    I need your insight for better understanding (and solve in case) google tracking issue in cart page. As you see below, in cart page (using wp easycart plugin) there is a script for collecting event for google.
    This script is not located in the header part but into the body (and google tag assistant considers it as an error) and the google ID is considered two times.

    Becasue I’d solve such errors, I need your help:

    – I have seen that this script is embedded into the plugin, is it correct?
    – I think such plugin is needed for tracking user are going to see the product , but such visits are considered two times? and why such script is not in header?

    I’ll appreciate any insight you might provide me, thanks Francesco

    (function(i,s,o,g,r,a,m){i[‘GoogleAnalyticsObject’]=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,’script’,’//www.google-analytics.com/analytics.js’,’ga’);ga(‘create’, ‘UA-110788654-1’, ‘auto’);ga(‘send’, ‘pageview’);ga(‘require’, ‘ec’);ga(‘ec:addImpression’,{‘id’: ‘JL-514V’,’name’: ‘ACCENDINO SPINNER A LED – Modello Classic’,’price’: ‘15.00’,});ga(‘send’, ‘pageview’);function ec_google_addToCart( ){ga(‘create’, ‘UA-110788654-1’, ‘auto’);ga(‘require’, ‘ec’);ga(‘ec:addProduct’, {‘id’: ‘JL-514V’,’name’: ‘ACCENDINO SPINNER A LED – Modello Classic’,’price’: ‘15.00’,’quantity’: document.getElementById( ‘product_quantity_JL-514V’ )});ga(‘ec:setAction’, ‘add’);ga(‘send’, ‘event’, ‘UX’, ‘click’, ‘add to cart’);}

    Tag Google twice in cart page
     
    #1

Share This Page

Monarch Social Sharing Plugin