nutritionix / nutrition-label

Create a FDA-style nutrition label with any nutrition data source (even the Nutritionix API - http://www.nutritionix.com/api)
http://www.nutritionix.com/
MIT License
176 stars 66 forks source link

Analytics tracking fails with gtag.js implementation. #116

Open lightson opened 5 years ago

lightson commented 5 years ago

Using the latest google analytics gtag.js code leads to event tracking failing. One would assume updating the gooleAnalyticsFunctionName to gtag (as below) would work, but no events are caught.

allowGoogleAnalyticsEventLog : true,
gooleAnalyticsFunctionName : 'gtag',
textGoogleAnalyticsEventCategory : 'Nutrition Label',
textGoogleAnalyticsEventActionUpArrow : 'Quantity Up Arrow Clicked',
textGoogleAnalyticsEventActionDownArrow : 'Quantity Down Arrow Clicked',
textGoogleAnalyticsEventActionTextbox : 'Quantity Textbox Changed',

example tracking code below...

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

  gtag('config', 'UA-17527682-18');
</script>
majin22 commented 5 years ago

@lightson just letting you know that I am not sure if I can work on this in the near future given the other tasks that I need to work on first.

lightson commented 5 years ago

No worries it's not a particularly big issue, just wanted to let you know.