[Drupal] Google AdWords in Drupal

| | 2 min read

Google AdWords offers a tracking code that allows you to keep track of how well your ads are performing - if someone clicks an ad and ends up at the conversion code, the ad was technically a success. Actually, the AdWords conversion code needs to only go on certain pages not on every page on the website.

In Google AdWords, you can advertise on the world's largest search engine. Web server is a partner with Google and offers all customers a Google AdWords coupon. You will receive AdWords coupon once then activated your web space and start getting new visitors to website.

Use new Google Analytics code. Google analytic code is installed on every page of website - typically in the footer.php file. If you are planning to use Google Analytics case you need to tell AdWords that this is the case and the Thank you page url.

There is a module in Drupal. It allows you choose which content-types and users will have the AdWords javascript attached. It will be able to set up node specific settings and global settings. This allows you to have more than one campaign running on your site.

Submodules included in Google Adwords module.

  • Google Adwords Path - Add tracking codes via URL paths instead of having to use fields.
  • Google Adwords Signup - Add tracking codes to user registration page

In Google Adwords module, Implements hook_commerce_checkout_pane_info(). This is where we define the name of the pane, related information, and the base name of all the form builder functions used to present the pane.

Example Pane: form callback in this module is checkout_pane_adwords_pane_checkout_form($form, &$form_state, $checkout_pane, $order). This is a standard FAPI form which will be presented in the pane. The form gathers and stores information from $order->data, an array which can be populated with free-form keys and values.

Below code is for creates a checkout pane in Drupal Commerce for Google AdWords tracking


      <!-- Google Code for Internet Sale Conversion Page -->
      <script type="text/javascript">
        /* <![CDATA[ */
        var google_conversion_id = YOUR_ADWORDS_ID;
        var google_conversion_language = "en";
        var google_conversion_format = "2";
        var google_conversion_color = "ffffff";
        var google_conversion_label = "YOUR_LABEL";
        var google_conversion_value = 0;
        /* ]]> */
      </script>
      <script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js"></script>
      <noscript>
      <div style="display:inline;">
        <img height="1" width="1" style="border-style:none;" alt="" src="//www.googleadservices.com/pagead/conversion/1041075554/?value=0&label=rObDCJqUmQUQ4pq28AM&guid=ON&script=0"/>
      </div>
      </noscript>
    

AdWords is a flexible way to advertise our website. You can always put your campaign on pause, adjust it or stop it if you like. AdWords is a quick advertising form and time-saving, where we put our ads up without any expertise. It is very easy to see and measure the results of your efforts. By means of clear and detailed reports, we can clearly see the outcome of effort, and AdWords is completely safe to use.

Reference:drupal.org