Adding Google Ads Tag

Hi,

I need to add the Google Ads tag on my website.
I already used X Theme’s Google analytics extension to add my Analytics number, it’s working fine.

According to Google, if Google analytics data is already installed on my website, I only have to copy and paste a ‘config command’ with my Ads number, just before the closing HTML tag, but in the extension, I can only add my Analytics number, and not the whole

Can I add this directly in the editor >> header.php?

Thanks for your help! :slight_smile:

Hi,

I need to add the Google Ads tag on my website.
I already used X Theme’s Google analytics extension to add my Analytics number, it’s working fine.
According to Google, if Google analytics data is already installed on my website, I only have to copy and paste a ‘config command’ with my Ads number, just before the closing HTML tag, but in the extension, I can only add my Analytics number, and not the whole script tag, so I can’t add another google number…

So how can I add my Ads number in the same Tag as Google Analytics’?

Step2, I have to add this code on one of my page (which is an article) in the head tag:
!-- Event snippet conversion page In your html page, add the snippet and call gtag_report_conversion when someone clicks on the chosen link or button. – script function gtag_report_conversion(url) { var callback = function () { if (typeof(url) != ‘undefined’) { window.location = url; } }; gtag(‘event’, ‘conversion’, { ‘send_to’: ‘MY GOOGLE NUMBER’, ‘event_callback’: callback }); return false; } /script

Can I add this directly in the editor >> header.php?

Thanks for your help! :slight_smile:

Hi there,

You can add the code through the functions.php file but it requires you to install and activate the child theme.

Please login through FTP then add this code to the child theme’s functions.php:

functions add_google_ads_script() {
?>
    <!-- Remove this line and add the script here -->
<?php
}

add_action( 'wp_footer', 'add_google_ads_script', 100 );

Hope this helps.

Hi @Jade !
Thanks for your help.
Does adding the child theme may break my website’s layout or its content? Or my extensions?
I mean I can’t build up my website from scratch as I’ve been working on it for months :confused:
Thanks

Hi There @OTBPiDo

All the child theme customizations will be kept separately on your child theme folder (/wp-content/themes/x-child/). If you encounter any conflict, you can remove particular customization that you have added or you can completely switch to your parent X theme (/wp-content/themes/x/), so that your child theme customizations will be ignored.

Hope that’s clear.

Hi @mldarshana!
Great, I’ll try this :slight_smile:
Thanks again for your help

You’re most welcome!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.