Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Google Analytics New 2020 Requirement - Need Help With Code Update Rate Topic   - - - - -

 
  • coder
  • Senior Member
  • Members
  • Join Date: 19-Jun 07
  • 411 posts

Posted 01 October 2020 - 01:31 PM #1

Received email from Google of changes that need to be done to Google Analytics code

 

 

<!-- Global site tag (gtag.js) - Google Analytics -->
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
 
  gtag('config', '{$addons.google_analytics.tracking_code}');
</script>
 
Current code 
/httpdocs/design/themes/responsive/templates/addons/google_analytics/hooks/index/
 
<script type="text/javascript" data-no-defer>
(function(i,s,o,g,r,a,m){
    i['GoogleAnalyticsObject']=r;
    i[r]=i[r]||function(){$ldelim}(i[r].q=i[r].q||[]).push(arguments){$rdelim},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', '{$addons.google_analytics.tracking_code}', 'auto');
ga('send', 'pageview', '{$ga_pageview_url|escape:javascript nofilter}');
</script>
 
Request if anyone can confirm if we have to just replace the current code to
 
<!-- Global site tag (gtag.js) - Google Analytics -->
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
 
  gtag('config', '{$addons.google_analytics.tracking_code}');
</script>
 
TIA

 


CS-CART: version 4.9.1


 
  • coder
  • Senior Member
  • Members
  • Join Date: 19-Jun 07
  • 411 posts

Posted 07 October 2020 - 06:17 PM #2

Any help would be appreciated...


CS-CART: version 4.9.1


 
  • soft-solid
  • Junior Member
  • Authorized Reseller
  • Join Date: 19-Apr 10
  • 1386 posts

Posted 07 October 2020 - 07:37 PM #3

Hello

 

What kind of help do you need ?

 

Best regards

Robert


Team of SoftSolid
cs-cart.pl, marketplace

We specialize in creating the highest quality addons, safe, useful and flexible


 
  • coder
  • Senior Member
  • Members
  • Join Date: 19-Jun 07
  • 411 posts

Posted 07 October 2020 - 07:40 PM #4

OK to replace the file with updated code? We tried but the website went down...


CS-CART: version 4.9.1


 
  • soft-solid
  • Junior Member
  • Authorized Reseller
  • Join Date: 19-Apr 10
  • 1386 posts

Posted 07 October 2020 - 08:13 PM #5

Hello

 

Please try close new code in tag <literal></literal>

 

Best regards

Robert


Team of SoftSolid
cs-cart.pl, marketplace

We specialize in creating the highest quality addons, safe, useful and flexible


 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 21740 posts

Posted 08 October 2020 - 05:11 AM #6

The correct solution is

{literal}
...paste code here...
{/literal}

GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      Multi-Vendor Ultimate       USD 7500 (6000)

 
  • soft-solid
  • Junior Member
  • Authorized Reseller
  • Join Date: 19-Apr 10
  • 1386 posts

Posted 08 October 2020 - 06:31 AM #7

Hello

 

Yes of course my slip of the tongue. Soory.

 

Best regards

Robert


Team of SoftSolid
cs-cart.pl, marketplace

We specialize in creating the highest quality addons, safe, useful and flexible


 
  • coder
  • Senior Member
  • Members
  • Join Date: 19-Jun 07
  • 411 posts

Posted 08 October 2020 - 08:30 PM #8

Thanks for the suggestion to add the code with {literal}, at least the site is not down but it is not pulling the analytics add-on code {$addons.google_analytics.tracking_code}. Refer to attached screen capture of the webpage/view source.

 

Suggest how to resolve.

Attached Files

  • Attached File  snip.JPG   35.47KB   2 downloads

CS-CART: version 4.9.1


 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 21740 posts

Posted 09 October 2020 - 04:43 AM #9

In this case please use the following code without literal tags
 

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id={$addons.google_analytics.tracking_code}"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){
    dataLayer.push(arguments);
  }
  gtag('js', new Date());
 
  gtag('config', '{$addons.google_analytics.tracking_code}');
</script>

GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      Multi-Vendor Ultimate       USD 7500 (6000)