• Resolved Ralf R.

    (@ralfreymann)


    Still great plugin, works very good ??

    Now I have a question: for e-commerce Tracking with an affiliate network I have to add some lines to the analytics codes:

    ————————————–
    var clientId = ”;
    ga(function (tracker) {
    clientId = tracker.get(‘clientId’);
    zxGPPana(‘zpar4’,clientId);
    });
    ————————————–

    Is there any possibility to ad manual lines to the analytics code from the plugin? Would be fine, if there is a function “ad manuell analytics code” with a text field, where I can include the lines and the plugin includes it in the code?

    Best regards and thank you for the great plugin ??

    https://www.ads-software.com/plugins/google-analytics-dashboard-for-wp/

Viewing 4 replies - 1 through 4 (of 4 total)
  • You can use the ga_dash_addtrackingcode action to add the required snippet inside the tracking code.

    Thread Starter Ralf R.

    (@ralfreymann)

    Hi, do you mean “enable cross domain tracking” and use this field or where do I find the Action you mean?

    No,

    You have to use an action hook to insert the code you need, for example if you have:

    <script>
      (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-XXYY3690-1', 'auto', {'siteSpeedSampleRate' : 50});
      ga('require', 'displayfeatures');
      ga('set', 'dimension4', 'guest');
      ga('send', 'pageview', {'anonymizeIp': true});
    </script>

    and you need to add

    var clientId = '';
    ga(function (tracker) {
    clientId = tracker.get('clientId');
    zxGPPana('zpar4',clientId);
    });

    for the code to look like:

    <script>
      (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-XXYY3690-1', 'auto', {'siteSpeedSampleRate' : 50});
      ga('require', 'displayfeatures');
      ga('set', 'dimension4', 'guest');
    
    var clientId = '';
    ga(function (tracker) {
    clientId = tracker.get('clientId');
    zxGPPana('zpar4',clientId);
    });
    
      ga('send', 'pageview', {'anonymizeIp': true});
    </script>

    you need to add this lines in your theme’s functions.php file:

    add_action('ga_dash_addtrackingcode', 'ga_ecommerce_addon');
    
    function ga_ecommerce_addon(){
     echo "var clientId = '';
    ga(function (tracker) {
    clientId = tracker.get('clientId');
    zxGPPana('zpar4',clientId);
    });";
    }
    Thread Starter Ralf R.

    (@ralfreymann)

    Thanks a lot for the good Explanation, I added code to functions.php and it seems to work ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Add manuel Analytics functions?’ is closed to new replies.