spicygreenbook / greenbook-app

We are Spicy Green Book – a virtual directory for Black-owned food and beverage businesses throughout the US and Canada. We help Black-owned food and drink business owners tell their story, sowing the seeds of trust, support, and positive change within local communities.
https://www.spicygreenbook.org
46 stars 60 forks source link

Add tracking for Google Ads conversions #437

Open zzlotoff opened 1 year ago

zzlotoff commented 1 year ago

Google Ads grants program requires optimizing off of conversion events, which requires placing their ad pixel conversion in the appropriate places on the website. There are 3 conversion events we'd like to track:

  1. Donating/Sponsoring
  2. Adding to the directory
  3. Searching the directory --- there is no special tag needed for this, other than the Google Tag (below) that we'll need to place on each page.

Google Tag We need to first implement the Google Tag, which can help track many more actions - for example, clickouts to other pages, such as merchants from our directory. We need to install this on every page of the website:

<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=AW-11059303354"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'AW-11059303354');
</script>

Tag for Donating/Sponsoring On the spicygreenbook.org/sponsors page, the following tag should track when someone clicks on Danilo's email or when they click the "Become a Sponsor" button:

<!-- Event snippet for Submit Sponsor Inquiry 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-11059303354/E7GsCKHjsYcYELqnvpkp',
      'event_callback': callback
  });
  return false;
}
</script>

Tag for adding a directory I think we may be able to do this without installing the tag - if there's a special "Thank you" page we send folks to after hitting "submit". I'll need to look around and/or submit a test lead form to see if this is the case.

BeatrizRSouza commented 1 year ago

I need a cloaker for google ads, does anyone work with this service?

zzlotoff commented 1 year ago

Hi, I am not technical but this message board seems to like JCI. Would that be compatible with our site?