
-
AuthorPosts
-
October 8, 2019 at 8:52 am #1146050
Hi,
I need to put the Global Google tag in my Enfold theme for remarketing, but I’m not sure how to do it. It supposes that I have to add the tag in <head> of each page, but I’m not able to see the head code.
Could you help me please?
P.S: I have the last version of Enfold .
October 8, 2019 at 10:13 am #1146092Hey,
Please refer to this post – https://kriesi.at/documentation/enfold/add-custom-js-or-php-script/#add-a-script-to-head-section :)
Regards,
YigitNovember 5, 2019 at 5:11 pm #1154029Hi,
I still don’t know how to add the code on my website :[
I need to add the global tag in the home and the event tag in one page.Could you help me please?
Thanks.
OscarNovember 6, 2019 at 6:45 am #1154177November 6, 2019 at 10:39 am #1154209Hi,
This is the code I need to add (Private content)
November 6, 2019 at 10:41 am #1154210Sorry, the code must be between <head></head> of each page.
November 6, 2019 at 10:29 pm #1154468Hi,
Did you try adding it to header.php?
Best regards,
Jordan ShannonNovember 6, 2019 at 10:53 pm #1154476Hi Jordan,
No, I didn’t. If I add the code in the header, doesn’t it add in complete website?
The Google support said to put the global tag just in the home and the event tag on the page I need the conversion.
Best regards,
OscarNovember 7, 2019 at 1:41 pm #1154631Hi Oscar,
Please try this function at the bottom of your functions.php file for the gtag code:
function ovacam_add_gtag(){ ?> //Your script code goes here <?php } add_action('wp_head', 'ovacam_add_gtag');
If the other code needs to be added to only one page then we need the ID of it, you can find that in the URL when you edit the page in question for example, or in the body tag on the front end.
Best regards,
RikardNovember 8, 2019 at 11:01 am #1154909Hi Rikard,
Thank you.
The ID is 3672.I look forward to your answer.
Best regards,
OscarNovember 8, 2019 at 11:08 am #1154911One question. Is the code correct?
function ovacam_add_gtag(){
?>
<!– Global site tag (gtag.js) – Google Ads: 924505948 –>
<script async src=”https://www.googletagmanager.com/gtag/js?id=AW-924505948″></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag(‘js’, new Date());gtag(‘config’, ‘AW-924505948’);
</script>
<?php
}
add_action(‘wp_head’, ‘ovacam_add_gtag’);November 9, 2019 at 4:04 am #1155146Hi,
Yes that looks correct, you can remove the comment tag as well:
<!– Global site tag (gtag.js) – Google Ads: 924505948 –>
Best regards,
RikardNovember 9, 2019 at 4:07 am #1155147Hi again,
Try this function for your other script on the conversion page:
function ovacam_add_conversion_page(){ if(is_page( 3672 )) { ?> <script> gtag(‘event’, ‘conversion’, {‘send_to’: ‘AW-924505948/zCEmCOzn9rIBENyu67gD’}); </script> <?php } } add_action('wp_head', 'ovacam_add_conversion_page');
Best regards,
RikardNovember 9, 2019 at 10:46 am #1155191Great Rikard!
I have added the gtab and the event tag in functions.php. Is this correct?From Google support say that in order to check the code is installed correctly, see font code from Google Chrome and it should appears the code, but I checked and I do not see neither of both.
Could you help me to check if I did well?
I would be grateful to you.
OscarNovember 10, 2019 at 5:30 am #1155297Hi Oscar,
Yes they should work in functions.php, we don’t have access to your site so we can’t really say if what you have done is wrong or right. Please post admin login details in private so that we can have a closer look.
Best regards,
RikardNovember 11, 2019 at 7:19 pm #1155742Hi Rikard,
After adding the code as you said me, there are not conversions, so I understand it’s no working well.
I post the admin login.
I look forward to your answer.
Best regards,
OscarNovember 12, 2019 at 6:46 am #1155840Hi,
Thanks for that, I can’t see any reason as to why the functions would not work. Maybe it’s due to to your caching plugin? What happens if you deactivate that?
Also, please note that what you add in to the parent theme will be overwritten on updates. You might want to consider adding a child theme: https://kriesi.at/documentation/enfold/child-theme/
Best regards,
RikardNovember 12, 2019 at 8:52 am #1155863Hi,
So, did you mean that the code is correctly installed?
I just disactivated the cache plugin and checked the conversion, but Google shows as unverified. :/
This is the meaning of Unverified (Extract Google):
Unverified: We haven’t verified that your tag has been put on your website yet. This takes a few hours. To make sure we see your tag, you can visit your conversion page (for example, the page confirming a purchase or mailing list sign-up). If it’s been more than 24 hours and you still see this status, skip to Confirm and verify your conversion tracking tag below.On the other hand, I have already installed a child theme, althoug I think it is not properly installed, because the style is not the same.
Best regards,
OscarNovember 13, 2019 at 3:57 am #1156255Hi Oscar,
You need to export the settings from your parent theme under Enfold->Import/Export, then import the settings when the child is active. If they don’t apply straight away then please try to change one or two settings in the theme and save again. Also remember to clear all caches.
Best regards,
RikardNovember 13, 2019 at 9:26 am #1156320Hi Rikard,
I did what you said and now is almost the same. However it does not apply some style items, like the font type and the colour area. I think only those things are not applyied.
I have checked Advanced Styles in child theme and the fonts are installed correctly, so I don’t understand why
You can see the screenshots of parent and child themes.
I have a doubt about child theme. When this is active, I understand that the url of website goes to child theme, am I right?
If that is correct, in order to check de gtag the child theme should be active for a while to check the conversion, right?Thank you very much for your support.
OscarNovember 14, 2019 at 2:59 am #1156602Hi Oscar,
I see the same thing on my end when I activate the child theme unfortunately, I’m not sure why your parent settings don’t carry over. I’ll ask the rest of the team to have a look too. Your caching/optimisation plugins might be at fault here, I tried deactivating them but nothing changed after that.
Best regards,
RikardNovember 14, 2019 at 8:46 am #1156679Hi Rikard,
Thank you, I appreciate it.
I look forward to your answer then.
Best regards,
OscarNovember 14, 2019 at 1:03 pm #1156766Hi Oscar,
I tried deleting and re-uploading your child theme however it does not show up in Appearance > Themes tab. Could you please post FTP logins here privately as well?
Best regards,
YigitNovember 14, 2019 at 1:20 pm #1156776Thank you Yigit. I post them below.
Best regards,
OscarNovember 14, 2019 at 1:31 pm #1156781Hi,
I am getting time out error. Could you please check if server in private content field is correct?
That field is only visible to you and moderators :)Best regards,
YigitNovember 14, 2019 at 1:36 pm #1156782Sorry Yigit, it was the logout url
November 16, 2019 at 1:21 pm #1157458Hi,
Thank you for the cPanel and WordPress logins, I have taken a look at your site and I adjusted your child theme so that it work correctly, the issue was that your parent theme was not in the default directory. I then moved your gtag scripts to the child theme functions.php and corrected the curly quotes in the code, and cleared your Autoptimize cache, and tested to ensure your scripts loaded correctly, which they do now.
Please clear your browser cache and check.Best regards,
MikeNovember 18, 2019 at 9:52 pm #1157957Hi Mike,
Thank you very much for all your help, I’m very gratefull.
I’ve just clear the browser cache and the web is loading correctly.
Now it seems that google detects gtag with child theme. Should I add the gtag code in the parent theme now or it’s not necessary?Best regards,
OscarNovember 19, 2019 at 1:20 pm #1158151Hi,
Glad to hear, you do not need to add to the parent theme as long as your child theme is active, a child theme is much better as you will not lose this code after your next update.
Shall we close this then?Best regards,
MikeNovember 19, 2019 at 2:02 pm #1158168Hi Mike,
Yes, you can close this ticket. Just a last question. So I leave the child theme active?
I thought the child theme was only for testing.Best regards,
Oscar -
AuthorPosts
- The topic ‘Add Global Google tag in my Enfold’ is closed to new replies.