• Resolved Julian Marin

    (@julianmarin)


    Hi, first, I want to say thank you so much for your plugin, it is a great tool.

    I just want to track clicks from the WhatsApp button, so I can see them in my google ads account.

    These are the instruccions from google ads:

    Add the snippet to the page that has a button or a link you’d like to track for clicks

    Copy the snippet below and paste it in between the <head></head> tags of the page(s) you’d like to track, right after the global site tag. Then, call gtag_report_conversion when someone clicks on the chosen link or button.

    I have already added the global tag and the snippet, but I don′t how to call “gtag_report_conversion”

    I really appreciate your help

Viewing 15 replies - 1 through 15 (of 16 total)
  • Plugin Author bhvreddy

    (@bhvreddy)

    Hi,

    Thank you so much for the message. currently If google analytics is installed on website, plugin creates an event in Google analytics when user clicks.

    please give us sometime to try to find a solution for Google Ads.

    Have a nice day,
    Thank you

    Thread Starter Julian Marin

    (@julianmarin)

    Hi, thanks I know that, but I need to call this: gtag_report_conversion

    Plugin Author bhvreddy

    (@bhvreddy)

    Hi,

    Thank you so much for the message, feature suggestion.

    Helped a lot.

    We just released a new version v3.2.8
    with added a feature to call gtag_report_conversion. ( please enable from plugin settings. ( Click to chat – other-setting )
    https://holithemes.com/plugins/click-to-chat/google-ads-conversion/

    Have a nice day!

    Thank you @bhvreddy! I need this feature as well.

    By the way @julianmarin, can I know what code do you put between <head></head>?

    • This reply was modified 3 years, 8 months ago by Japracool.
    • This reply was modified 3 years, 8 months ago by Japracool.
    Thread Starter Julian Marin

    (@julianmarin)

    Hi @japracool that function is already included in the plugin

    • This reply was modified 3 years, 8 months ago by Julian Marin.
    Thread Starter Julian Marin

    (@julianmarin)

    go to other settings

    • This reply was modified 3 years, 8 months ago by Julian Marin.

    Thank you for the fast response @julianmarin

    Right now my code is:

    <script>
    document.addEventListener("DOMContentLoaded", function(event) {
           var elements = document.querySelectorAll('[href*="wa.me"]');
           for (var i = 0; i < elements.length; i++) {
               elements[i].addEventListener("click", function(event) {
                    gtag('event', 'conversion', {'send_to': 'bla bla bla'});
               });
           }
       });
    </script>

    So should I input your code below it?

    • This reply was modified 3 years, 8 months ago by Japracool.
    Thread Starter Julian Marin

    (@julianmarin)

    @japracool just use the function that the plugin has

    Plugin Author bhvreddy

    (@bhvreddy)

    Hi @japracool,

    If enabled google ads conversation settings from click to chat plugin.
    (click to chat -> other-settings – Analytics )

    Then plugin will call gtag_report_conversion function.

    please add the gtag scripts, gtag_report_conversion function at the <head> tags as mentioned by google ads.

    Thank you so much for the help @julianmarin

    We plan to improve this feature in much better way. Happy to receive any suggestion.

    Have a nice day,
    Thank you`

    Hi @bhvreddy,

    Can you explain more further for:

    please add the gtag scripts, gtag_report_conversion function at the <head> tags as mentioned by google ads.

    Do you mean I must edit this code?

    <script>
      gtag('event', 'conversion', {'send_to': 'bla bla bla'});
    </script>
    

    I edit into

    <script>
      gtag_report_conversion('event', 'conversion', {'send_to': 'bla bla bla'});
    </script>
    

    Something like that?

    Plugin Author bhvreddy

    (@bhvreddy)

    Hi,

    plugin calls gtag_report_conversion function when user clicks on plugin icon/button

    please insert the code at head tags. something it looks like this

    <!-- Event snippet for click 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': 'AW-******/************',
          'value': 10.0,
          'currency': 'INR',
          'event_callback': callback
      });
      return false;
    }
    </script>

    before this we need to install Global site tag also.

    so when user clicks on icon/button plugin calls this function ( gtag_report_conversion ) and your google ads will take care the rest based on that convesation action settings.

    https://gyazo.com/5998316c652030f09a10aec308e41d88

    Have a nice day,
    Thank you

    Thank you @bhvreddy

    1 last question, here’s my complete code in <head></head>

    <script async src="https://www.googletagmanager.com/gtag/js?id=AW-xxxxxxxxx"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());
    
      gtag('config', 'AW-xxxxxxxxx');
    </script>
    
    <script>
        document.addEventListener("DOMContentLoaded", function(event) {
           var elements = document.querySelectorAll('[href*="wa.me"],[href*="tel:"],[href*="mailto:"]');
           for (var i = 0; i < elements.length; i++) {
               elements[i].addEventListener("click", function(event) {
                    gtag('event', 'conversion', {'send_to': 'AW-xxxxxxxxx/bla bla bla'});
               });
           }
       });
    </script>
    
    <script>
    function gtag_report_conversion(url) {
      var callback = function () {
        if (typeof(url) != 'undefined') {
          window.location = url;
        }
      };
      gtag('event', 'conversion', {
          'send_to': 'AW-xxxxxxxxx/bla bla bla',
          'event_callback': callback
      });
      return false;
    }
    </script>

    The 1st script:
    Global Site Tag

    The 2nd script:
    My custom script to track link click for WhatsApp, phone, and email

    The 3rd script:
    To track click from your plugin

    Am I doing it right? Or I should combine script 2 and 3?

    • This reply was modified 3 years, 8 months ago by Japracool.
    • This reply was modified 3 years, 8 months ago by Japracool.
    • This reply was modified 3 years, 8 months ago by Japracool.
    • This reply was modified 3 years, 8 months ago by Japracool.

    ^I think my code above worked

    I tried to click my on ads 2 days ago and Google recorded my conversion

    Plugin Author bhvreddy

    (@bhvreddy)

    Hi,

    Sorry for the late reply.

    yes, its seems every things is perfect. nice to hear that the google ads conversation is working fine.

    Have a nice week
    Thank you

    Hi @bhvreddy

    I was wondering, for the current version. Do I still need this code between <head></head> tags?

    <!-- Global site tag (gtag.js) - Google Ads: XXXXX -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=XXXXX"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());
    
      gtag('config', 'AW-XXXXX');
    </script>
    
    <!-- Event snippet for WhatsApp 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': 'AW-XXXXX/XXXXX',
          'event_callback': callback
      });
      return false;
    }
    </script>

    Or I can just remove it?

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Conversions on Google Ads’ is closed to new replies.