KirkM Posted March 29, 2020 Share Posted March 29, 2020 Strangest thing - I upgraded from 6.1.13 to 6.2.9 a little bit ago and my client just noticed that there is no GA feed to his GA account. The really strange part of it is that it isn't an instant drop off. It goes from Feb 2 to Feb 17 in a sharp decline to zero over days. I don't know if the upgrade has anything to do with it or not. If it did, you would think it would have dropped to zero instantly when the upgrade was done. I have diffmerged all of the files to make sure that everything is the same on my installation as the clean version of 6.2.9, including matching my custom skin to the foundation skin with only my css changes the difference. Everything seems to be there. Also, I noticed that Google Tag manager shows no Google Pixel on the site when I go to it in Chrome. I also checked to make sure the element.google_analytics.php file is there in the skin templates file. Not sure where to start looking for this. Link to comment Share on other sites More sharing options...
bsmither Posted March 29, 2020 Share Posted March 29, 2020 I have no answer about if anything that CubeCart code may affect. I am not aware of any changes regards GA. I do not recall when the GDPR Cookie Consent was added to CubeCart, but there may be some interaction (I don't know for sure) between a visitor accepting, or not, of accepting third-party cookies. But this is interesting: https://support.google.com/analytics/thread/23037040?hl=en I would ask if your hosting account's WebAnalytics feature shows a traffic rate that matches the GA trend line. Link to comment Share on other sites More sharing options...
bsmither Posted March 29, 2020 Share Posted March 29, 2020 Having just now compared CC618 vs CC629 Foundation template element.google_analytics.php, there is now a test if there is a cookie named 'accept_cookies' with a value of true. I'm not sure where an admin can see the cookie acceptance rate. Does your skin match this test? Does your skin's GA code anonymize the IP address? Link to comment Share on other sites More sharing options...
KirkM Posted March 29, 2020 Author Share Posted March 29, 2020 My skin is basically the Foundation skin with a few css tweaks. It should be doing exactly what the Foundation skin does. I will have to hunt around and see if I can find what you are talking about. In the mean time, I see a LOT of this in the error logs: File: [controller.admin.pre_session.inc.php] Line: [26] "SET @@time_zone = 'America/Los_Angeles'" - Unknown or incorrect time zone: 'America/Los_Angeles' File: [controller.index.inc.php] Line: [27] "SET @@time_zone = 'America/Los_Angeles'" - Unknown or incorrect time zone: 'America/Los_Angeles' Don't understand how that can be since it is the correct formatting for a timezone and it is selected from the admin drop-down menu. Edit: It does it with all timezone choices. Edit #2: It appears it is not relevant to this situation per this thread - https://forums.cubecart.com/topic/55533-error-about-timezone/ Link to comment Share on other sites More sharing options...
KirkM Posted March 30, 2020 Author Share Posted March 30, 2020 So it has something to do with the cookie acceptance. If I go to skins/foundation/templates/element.google_analytics.php and take out the smarty {if} statement, it works fine. Original code: {if isset($smarty.cookies.accept_cookies) && $smarty.cookies.accept_cookies=='true'} {literal}<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', '{/literal}{$ANALYTICS}{literal}', 'auto'); ga('set', 'anonymizeIp', true); ga('send', 'pageview'); </script>{/literal} {/if} Removed the {if} statement and that works: {literal}<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', '{/literal}{$ANALYTICS}{literal}', 'auto'); ga('set', 'anonymizeIp', true); ga('send', 'pageview'); </script>{/literal} I don't see where this cookie acceptance is unless it is in the GDPR settings. In this store, they are both off. Does the cookie compliance dialog have to be on for the GA code to work? Link to comment Share on other sites More sharing options...
bsmither Posted March 30, 2020 Share Posted March 30, 2020 Smarty has the ability to look at data that the web server provided to PHP, including the cookies. So... {if isset($smarty.cookies.accept_cookies) && $smarty.cookies.accept_cookies=='true'} is what you are wanting to see. If there is no cookie, or the visitor declined to accept third-party cookies (value being false), the GA code won't be appearing in the HTML sent to the visitor. The "Cookie Compliance Dialogue" setting is new to me -- I'll have to examine the code to see how CubeCart handles that and what effects it has. Link to comment Share on other sites More sharing options...
KirkM Posted March 30, 2020 Author Share Posted March 30, 2020 Using DevTools in Chrome, I cleared all cookies from the site and then loaded a couple of pages. I see a lot of cookies being stored from the CC store, but none that appear to be any of the listed cookie names used by Smarty. I need to find out where the $smarty.cookies.accept_cookies variable is stored and how it is triggered to true. Perhaps this is a result of the "Cookie Compliance Dialog" not being active in the store? Link to comment Share on other sites More sharing options...
bsmither Posted March 30, 2020 Share Posted March 30, 2020 I traced out the code and I am convinced that the admin setting needs to be enabled. Link to comment Share on other sites More sharing options...
KirkM Posted March 31, 2020 Author Share Posted March 31, 2020 I just did a test with the original code restored and the CCD enabled and it appears you are correct. Thanks for tracking that down. Seeing that the GDPR extends to any company who could possibly do business with anyone in Europe, I suppose it should just be enabled by default in CC since theoretically every store on the web is doing business "worldwide". Link to comment Share on other sites More sharing options...
windsurfer Posted October 15, 2020 Share Posted October 15, 2020 I have my Analytics ID filled out in the store settings Now Google wants me to put some code in the <head> section of every page so i put this in the <head> section of the template main.php When i do that the site crashes and only displays a blank page. Any reason for that ? Link to comment Share on other sites More sharing options...
bsmither Posted October 15, 2020 Share Posted October 15, 2020 If the "code" contains any braces, they must be surrounded by "white space". Bad: <script>var foo={a:b}{c:d};</script> <style>.bar{width:17px;}</style> Good: {literal}<script>var foo={a:b}{c:d};</script>{/literal} <style> .bar { width:17px; } </style> The first example tells the Smarty template rendering engine to ignore any braces found wrapped by {literal} tags. The second example shows spaces and line endings surrounding the braces. This does not match what Smarty is looking at for its template commands. Link to comment Share on other sites More sharing options...
havenswift-hosting Posted October 15, 2020 Share Posted October 15, 2020 4 hours ago, windsurfer said: Now Google wants me to put some code in the <head> section of every page so i put this in the <head> section of the template main.php Foundation already has this code added and so any skin based on this should also have this code already added so no need to try adding it again Ian Link to comment Share on other sites More sharing options...
windsurfer Posted October 16, 2020 Share Posted October 16, 2020 Great Thank you. Link to comment Share on other sites More sharing options...
3D Time Posted December 7, 2020 Share Posted December 7, 2020 Im not sure what i have done wrong, i have added the number into the store part but i cant get anything in the Analytics, any ideas? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.