Page 1 of 2 12 LastLast
Results 1 to 10 of 96

Hybrid View

  1. #1
    Join Date
    Jan 2007
    Location
    Los Angeles, California, United States
    Posts
    10,023
    Plugin Contributions
    32

    Default Google Ecommerce Tracking

    Found multiple posts with no clear answers on this.. Found the code below for adding Google ecommerce tracking in an old post.
    Can someone confirm this is correct or guide me to WHERE I might find the right code for Zen Cart to add ecommerce tracking..

    Code:
    <script type="text/javascript">
    
    var _gaq = _gaq || [];
      _gaq.push(['_setAccount', 'UA-xxxxxx-1']);
      _gaq.push(['_trackPageview']);
      _gaq.push(['_addTrans','<?php echo $zv_orders_id ?>','','<?php echo $zv_order_total_cd ?>','<?php echo $zv_order_tax ?>','<?php echo $order_summary['shipping'] ?>','<?php echo $zv_order_city ?>','<?php echo $zv_order_state ?>','<?php echo $zv_order_country ?>']);
    
      _gaq.push(['_addItem','<?php // Loop through products purchased to track in Google (these come from the "cart_orders_products TABLE)
    //sku = "products_model"; productname = "products_name"; category = ""; price = "final_price"; quantity = "products_quantity"
    $products_displayed_google = array();
    for ($i=0, $n=sizeof($products_array_google); $i<$n; $i++) {
    if (!in_array($products_array_google[$i]['id'], $products_displayed_google)) {
    echo  $zv_orders_id . '\',
    \'' . $products_array_google[$i]['model'] . '\',
    \'' . $products_array_google[$i]['text'] . '\',
    \'\',
    \'' . $products_array_google[$i]['price'] . '\',
    \'' . $products_array_google[$i]['quantity'] . '\'
    ' . ((($i+1)<$n) ? ',\'' : '' ) ;
    
    }
    }
    
    ?>])
      _gaq.push(['_trackTrans']); //submits transaction to the Analytics servers
    
      (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
      })();
       __utmSetTrans()
    
    </script>
    Last edited by DivaVocals; 30 Apr 2015 at 09:41 AM.
    My Site - Zen Cart & WordPress integration specialist
    I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

  2. #2
    Join Date
    Dec 2009
    Location
    Amersfoort, The Netherlands
    Posts
    2,845
    Plugin Contributions
    25

    Default Re: Google Ecommerce Tracking

    I think I saw that code in the latest Easy Google Analytics mod

  3. #3
    Join Date
    Jan 2007
    Location
    Los Angeles, California, United States
    Posts
    10,023
    Plugin Contributions
    32

    Default Re: Google Ecommerce Tracking

    Quote Originally Posted by Design75 View Post
    I think I saw that code in the latest Easy Google Analytics mod
    I do know it's there, but I ONLY need/want the Google ecommerce tracking (regular Analytics tracking is handled).. Do you know offhand if there is there a way to activate JUST the Google ecommerce tracking using the Easy Google Analytics module?
    My Site - Zen Cart & WordPress integration specialist
    I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

  4. #4
    Join Date
    Dec 2009
    Location
    Amersfoort, The Netherlands
    Posts
    2,845
    Plugin Contributions
    25

    Default Re: Google Ecommerce Tracking

    Quote Originally Posted by DivaVocals View Post
    I do know it's there, but I ONLY need/want the Google ecommerce tracking (regular Analytics tracking is handled).. Do you know offhand if there is there a way to activate JUST the Google ecommerce tracking using the Easy Google Analytics module?
    no sorry i do not. I have not had the chance to use it yet.

  5. #5
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: Google Ecommerce Tracking

    Quote Originally Posted by DivaVocals View Post
    I do know it's there, but I ONLY need/want the Google ecommerce tracking (regular Analytics tracking is handled).. Do you know offhand if there is there a way to activate JUST the Google ecommerce tracking using the Easy Google Analytics module?
    I'm in the final stages of testing some ec analytics code as we speak (actually, I've been testing and tweaking since just before xmas) and am just about at the stage where it would be good to have another set of eyes check it out.

    I have to admit, I've never used the Easy Analytics module and I have no idea if using my module in conjunction with this will cause any conflicts anywhere. My code has been created specifically for the EC tracking, but it also tracks some of the other common 'events' (and all pageviews).

    My code doesn't require any changes to any of the zencart files. Just 4 new files to upload (with one of those needing to have the UA-xxxxxxx.x number inserted.

    Let me know if you are interested in being a guinea pig. Just one thing to keep in mind - There is no way to 'undo' any data submitted to the Google Analytics, so if something goes amiss (such as the same data being logged twice) you'll be stuck with the results/report.

    Cheers
    RodG

  6. #6
    Join Date
    Jan 2007
    Location
    Los Angeles, California, United States
    Posts
    10,023
    Plugin Contributions
    32

    Default Re: Google Ecommerce Tracking

    Quote Originally Posted by RodG View Post
    I'm in the final stages of testing some ec analytics code as we speak (actually, I've been testing and tweaking since just before xmas) and am just about at the stage where it would be good to have another set of eyes check it out.

    I have to admit, I've never used the Easy Analytics module and I have no idea if using my module in conjunction with this will cause any conflicts anywhere. My code has been created specifically for the EC tracking, but it also tracks some of the other common 'events' (and all pageviews).

    My code doesn't require any changes to any of the zencart files. Just 4 new files to upload (with one of those needing to have the UA-xxxxxxx.x number inserted.

    Let me know if you are interested in being a guinea pig. Just one thing to keep in mind - There is no way to 'undo' any data submitted to the Google Analytics, so if something goes amiss (such as the same data being logged twice) you'll be stuck with the results/report.

    Cheers
    RodG
    Rod I could kiss you!!! YES I'll guinea pig it, and accept the caveat/risk.. (the risk is minor in the scheme of things) I am NOT using any Google Analytics plugin because this site is one of my WordPress/Zen Cart integration sites, and I am using the WordPress Google Analytics plugin to grab those stats for both WordPress and Zen Cart.. The WordPress plugin obviously doesn't support Google Ecommerce Analytics for Zen Cart (there are plugins for WooCommerce, etc). So I only need the Google Ecommerce Analytics for Zen Cart.
    My Site - Zen Cart & WordPress integration specialist
    I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

  7. #7
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: Google Ecommerce Tracking

    Quote Originally Posted by DivaVocals View Post
    YES I'll guinea pig it, and accept the caveat/risk.
    <snip>
    So I only need the Google Ecommerce Analytics for Zen Cart.
    I've just sent you a PM with a link to download.

    If anyone else wishes to be a guinea pig please PM me.

    Cheers
    RodG

    ps. This is/will be a free plugin/addon

  8. #8
    Join Date
    May 2016
    Location
    Bucharest
    Posts
    48
    Plugin Contributions
    0

    Default Re: Google Ecommerce Tracking

    Can anyone tel how to anonymise ip with module, where to put the code so that the visitor's ip is anonymised in Google Analytics?
    I read that this code should be inserted in the GA snippet ---- ga('set', 'anonymizeIp', true); --- but not sure where it should go in the EC Analytics Module, and also how to test if it does the job.

    Also, is this module sending user ID information to Google Analytics? We don't want this information to be sent by our website to GA.

    Need these handeled to make our GA GDPR compilant without the need to gather consent from visitors to run GA.

    10x

  9. #9
    Join Date
    Sep 2005
    Location
    Austria
    Posts
    101
    Plugin Contributions
    6

    Default Re: Google Ecommerce Tracking

    To use anomyzizeIP with this plugin:

    includes/templates/YOURTEMPLATE/jscript/jscript_ec_analytics.php

    around line 29
    change from

    Code:
    <?php
    //global $analytics, $cID;
    $cID = (isset($_SESSION['customer_id'])) ? "customerID#".$_SESSION['customer_id']:"guest";
    echo ($cID === "guest") ? "ga('create', '".$trackingID."', 'auto') ;\n":"ga('create', '".$trackingID."', {'userId':'{$cID}'});\n";   
    echo "ga('require', 'ec');\n"; 
    echo "ga('require', 'displayfeatures');\n";
    if (!isset($_SESSION['analytics'])) {  echo "ga('send', 'pageview');\n";}
    to

    Code:
    <?php
    global $analytics, $cID; 
    $cID = (isset($_SESSION['customer_id'])) ? "customerID#".$_SESSION['customer_id']:"guest";
    echo ($cID === "guest") ? "ga('create', '".$trackingID."', 'auto') ;\n":"ga('create', '".$trackingID."', {'userId':'{$cID}'});\n";
    echo "ga('set', 'anonymizeIp', true); \n";     
    echo "ga('require', 'ec');\n"; 
    echo "ga('require', 'displayfeatures');\n";
    if (!isset($_SESSION['analytics'])) {  echo "ga('send', 'pageview');\n";}
    To be GDPR compliant you should also support the GA Opt-Out Cookie:

    Integrate the following link to your privacy policy:

    Code:
    <a onclick="alert('Google Analytics has been disabled');"href="javascript:gaOptout()">Disable Google Analytics</a>
    And integrate the following script somewhere in the head section in includes/templates/YOURTEMPLATE/common/html_header.php
    (Change UA-1234567 to your own ID)

    Code:
    <script type="text/javascript">
    var gaProperty = 'UA-1234567';
    var disableStr = 'ga-disable-' + gaProperty;
    if (document.cookie.indexOf(disableStr + '=true') > -1) { window[disableStr] = true;
    }
    function gaOptout() {
    document.cookie = disableStr + '=true; expires=Thu, 31 Dec 2099 23:59:59 UTC; path=/';
    window[disableStr] = true; }
    </script>
    The user ID is sent to Google Analytics but this does not contain any personal data so I' m not sure what should not be GDPR compliant doing so.

  10. #10
    Join Date
    May 2016
    Location
    Bucharest
    Posts
    48
    Plugin Contributions
    0

    Default Re: Google Ecommerce Tracking

    Quote Originally Posted by webchills View Post
    To use anomyzizeIP with this plugin:

    includes/templates/YOURTEMPLATE/jscript/jscript_ec_analytics.php

    around line 29
    change from

    Code:
    <?php
    //global $analytics, $cID;
    $cID = (isset($_SESSION['customer_id'])) ? "customerID#".$_SESSION['customer_id']:"guest";
    echo ($cID === "guest") ? "ga('create', '".$trackingID."', 'auto') ;\n":"ga('create', '".$trackingID."', {'userId':'{$cID}'});\n";   
    echo "ga('require', 'ec');\n"; 
    echo "ga('require', 'displayfeatures');\n";
    if (!isset($_SESSION['analytics'])) {  echo "ga('send', 'pageview');\n";}
    to

    Code:
    <?php
    global $analytics, $cID; 
    $cID = (isset($_SESSION['customer_id'])) ? "customerID#".$_SESSION['customer_id']:"guest";
    echo ($cID === "guest") ? "ga('create', '".$trackingID."', 'auto') ;\n":"ga('create', '".$trackingID."', {'userId':'{$cID}'});\n";
    echo "ga('set', 'anonymizeIp', true); \n";     
    echo "ga('require', 'ec');\n"; 
    echo "ga('require', 'displayfeatures');\n";
    if (!isset($_SESSION['analytics'])) {  echo "ga('send', 'pageview');\n";}
    To be GDPR compliant you should also support the GA Opt-Out Cookie:

    Integrate the following link to your privacy policy:

    Code:
    <a onclick="alert('Google Analytics has been disabled');"href="javascript:gaOptout()">Disable Google Analytics</a>
    And integrate the following script somewhere in the head section in includes/templates/YOURTEMPLATE/common/html_header.php
    (Change UA-1234567 to your own ID)

    Code:
    <script type="text/javascript">
    var gaProperty = 'UA-1234567';
    var disableStr = 'ga-disable-' + gaProperty;
    if (document.cookie.indexOf(disableStr + '=true') > -1) { window[disableStr] = true;
    }
    function gaOptout() {
    document.cookie = disableStr + '=true; expires=Thu, 31 Dec 2099 23:59:59 UTC; path=/';
    window[disableStr] = true; }
    </script>
    The user ID is sent to Google Analytics but this does not contain any personal data so I' m not sure what should not be GDPR compliant doing so.
    Thanks,

    I inserted the code, but how do I test if the ip is indeed anonimysed?
    Also, the disable GA script seems to work but what if the user wants to re enable Google Analytics back, how is this done?

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 6
    Last Post: 3 Oct 2013, 10:36 PM
  2. Ecommerce Tracking code for Google Analytics
    By Endre in forum General Questions
    Replies: 7
    Last Post: 14 Nov 2012, 03:20 PM
  3. MailChimp Ecommerce MC360 tracking?
    By irishshopper in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 26 Oct 2010, 11:21 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR