Home › Forums › WoodMart support forum › Google Anlitics – How to add it without a plugin?
Google Anlitics – How to add it without a plugin?
- This topic has 7 replies, 2 voices, and was last updated 1 year, 1 month ago by
Hung Pham.
-
AuthorPosts
-
January 16, 2024 at 9:40 pm #530534
MatimtiParticipantHow do I add Google Analytics to my Woodmart store? I wanted to do it without adding unnecessary plugins and in a way that would allow me to easily add various tags for conversion measurements in the future.
January 17, 2024 at 10:54 am #530669
Hung PhamKeymasterHi Matimti,
Thanks for reaching to us.
Unfortunately, there is no such option in Theme Settings.
The best way to add the Google Analytics code is by using this free plugin Insert Headers and Footers, have a look at the site
https://wordpress.org/plugins/insert-headers-and-footers/Regards,
January 17, 2024 at 11:47 am #530708
MatimtiParticipantI wonder if it is possible to add such code to a child theme? Earlier, I gave up the snipet code plugin in favor of moving the codes to a child theme. I have mixed feelings about installing another plugin 😛
January 17, 2024 at 11:55 am #530713
Hung PhamKeymasterHi Matimti,
Please try to add to functions.php file in Child theme.
function child_google_analytics() { ?> <!-- Paste your Google Analytics code here and remove this message --> <?php } add_action('wp_head', 'child_google_analytics');
Regards,
January 17, 2024 at 12:27 pm #530724
MatimtiParticipantThank you very much. Would you be able to create such code for the “body” section?
Below is the information from Google Tag Manager:“Additionally, paste this code immediately after the opening <body> tag:”
January 17, 2024 at 1:10 pm #530746
Hung PhamKeymasterHi Matimti,
Please remove previous code try to add to functions.php file in Child theme.
function child_google_analytics() { ?> <!-- Paste your Google Analytics code here and remove this message --> <?php } add_action('wp_body_open', 'child_google_analytics');
Regards,
January 17, 2024 at 1:42 pm #530764
MatimtiParticipantThank you! Can I paste both codes because I have a tag for the head and body sections? I didn’t express myself precisely earlier.
January 17, 2024 at 1:57 pm #530775
Hung PhamKeymasterHi Matimti,
Yes you can, but need to change function name first, for e.g:
function child_google_analytics1() { ?> <!-- Paste your Google Analytics code here and remove this message --> <?php } add_action('wp_body_open', 'child_google_analytics1'); function child_google_analytics() { ?> <!-- Paste your Google Analytics code here and remove this message --> <?php } add_action('wp_head', 'child_google_analytics');
Regards,
-
AuthorPosts
- You must be logged in to create new topics. Login / Register