Tagged: x
-
AuthorPosts
-
March 23, 2017 at 12:22 am #1417224
Hi amazing X theme techs!
I am trying to add Google Analytics code to Functions.php in Child theme, and messed up the site! I got it back by re-uploading the original Functions file but seek your assistance in how to put in the code.
My web host says to use this code:<?php add_action('wp_footer', 'add_googleanalytics'); function add_googleanalytics() { ?> // Paste your Google Analytics code from Step 6 here <?php } ?>
The Google Analytics website says that this is our Analytics code:
<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','https://www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-22707452-1', 'auto'); ga('send', 'pageview'); </script>
Please let me know how to insert this into Functions.php without breaking the site.
thanksMarch 23, 2017 at 12:27 am #1417231This reply has been marked as private.March 23, 2017 at 12:34 am #1417239Never mind u answered my question in another post, thanks!
March 23, 2017 at 1:31 am #1417269Glad we could help, Cheers!
March 23, 2017 at 1:33 am #1417271HELP!!! Goog Analytics was working fine for awhile then suddenly the site went down again with this error:
Parse error: syntax error, unexpected ‘<‘ in /home/tellas5/public_html/wp-content/themes/x-child/functions.php on line 44So I ripped the Gog Analytics code out of Functions.php again, now the site is STILL NOT WORKING UNLESS I manuallytype in “https://www.tellasia.org” If I just put “tellasia.org” in the url field, it gives the same error.
So even without the Analytics code, something seems to be messed up. Please check… and plz fix or tell us how to fix.
Here’s the code we put in Functions.php in Child theme (which is not currently there as it seems to have put the whole site down after working for a short time):
// Add Google Analytics // ============================================================================= function third_party_tracking_code() { ?> <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','https://www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-22707452-1', 'auto'); ga('send', 'pageview'); </script> <?php } add_action( 'wp_footer', 'third_party_tracking_code' ); // =============================================================================
March 23, 2017 at 3:41 am #1417357Hi there,
It seems that you have changed your WP login credentials. We need FTP credentials to check your issue.
Thanks!
March 23, 2017 at 3:59 am #1417369This reply has been marked as private.March 23, 2017 at 6:14 am #1417476Hi Leanna,
Please provide us ftp access in private reply so we can add the code properly.
Thanks
March 23, 2017 at 6:24 am #1417487This reply has been marked as private.March 23, 2017 at 6:38 am #1417503Hi there,
Yes, please remove that code and use our Google Analytics extension. We have a complete integration guide here (https://community.theme.co/kb/extension-google-analytics/).
Thanks!
March 23, 2017 at 7:43 am #1417555It works, thank you!
Now all we need to solve is why, when I type “tellasia.org” into Chrome without adding www, I’m still getting “Parse error: syntax error, unexpected ‘<‘ in /home/tellas5/public_html/wp-content/themes/x-child/functions.php on line 44”this is very concerning because nobody manually types www nowdays…
I’ve cleared all cache in browser and website but still occuring on all my computers.
March 23, 2017 at 7:48 am #1417562Hi there,
I have checked your site on Chrome & Firefox, but I could not experience such issue. If you can check with another computer in a different location and see if you get the same issue.
Thanks!
March 24, 2017 at 4:02 am #1418773ok thanks. The problem continues in India on all our computers, but nobody in the US can replicate the error. Odd.
March 24, 2017 at 6:55 am #1418871Hi Leanna,
I can’t duplicate the issue. When I type tellasia.org it redirect to https://www.tellasia.org/ and loads properly.
March 24, 2017 at 1:35 pm #1419361ok
-
AuthorPosts