Drupal module & GA code on SSL

42 views
Skip to first unread message

Charles S

unread,
Mar 6, 2018, 4:07:17 PM3/6/18
to Cookie Control Support

I have a couple questions, regarding the Drupal plugin for Cookie Control, and proper implementation. I'm hoping I'm just overthinking, or missing something...


First, we already have a Google Analytics plugin for this site, adding the GA code to the page.  

When I drop in a GA code snippet in Cookie Control, it appears duplicated in the code, because of the previous module? Does Cookie Control completely replace the need to use the Google Analytics Module? Or do both need to be in place?


Also, I want to be sure I'm dropping in the correct code. The module says to not use <script> tags, but I think doing so may cause a problem with me posting on our site for SSL? In Google Analytics, one of the script tags contains the https url to load? See below:

 


<!-- Global site tag (gtag.js) - Google Analytics -->

<script async src="https://www.googletagmanager.com/gtag/js?id=UA-123123123-0"></script>

<script>

  window
.dataLayer = window.dataLayer || [];

 
function gtag(){dataLayer.push(arguments);}

  gtag
('js', new Date());

  gtag
('config', 'UA-123123123-0');

</script>



Thanassis Perperis

unread,
Mar 7, 2018, 3:41:53 AM3/7/18
to Cookie Control Support
Dear Charles,

The actual code you will need to add is: jQuery.getScript("https://www.google-analytics.com/ga.js", function() {var GATracker = _gat._createTracker('{UA-123123123-0}');GATracker._trackPageview();});

Best regards,
Thanassis
Reply all
Reply to author
Forward
0 new messages