Implementing SSL path in Drupal module

#1
Hi, I'm the maintainer of the Drupal Statcounter module. A user has submitted a bug report concerning the use of Statcounter on a site with SSL.

I see that the latest version of the StatCounter code tracks HTTPS hits by default.

Does that mean that secure pages tracking is now also available to the free non-upgraded accounts?

Thanks
 

Rory_A

Administrator
Staff member
#4
Hi, I'm the maintainer of the Drupal Statcounter module. A user has submitted a bug report concerning the use of Statcounter on a site with SSL.

I see that the latest version of the StatCounter code tracks HTTPS hits by default.

Does that mean that secure pages tracking is now also available to the free non-upgraded accounts?

Thanks
Hi,

Thanks for your message. Yes, secure tracking is now available for free non-upgraded accounts. Please use the default version of the code which auto switches between http and https. If you need the old code can be used in this format. There are a handful of editors which modify / break the auto switching code, but won't break the old code.

<!-- Start of StatCounter Code for Default Guide -->
<script type="text/javascript">
var sc_project=PROJECT ID;
var sc_invisible=1;
var sc_security="SECURITY CODE";
</script>
<script type="text/javascript"
src="https://statcounter.com/counter/counter.js"></script>
<noscript><div class="statcounter"><a
href="http://statcounter.com/wordpress.org/"
target="_blank"><img
src="https://c.statcounter.com/PROJECT ID/SECURITY CODE/1/"
alt="site stats"></a></div></noscript>
<!-- End of StatCounter Code for Default Guide -->

I hope this helps :)

Regards,
Rory
StatCounter Team
 
#6
switching between http and https

Hi,

sorry for not checking back in earlier, I seem to have stopped received follow-up emails from this thread.

Yes, secure tracking is now available for free non-upgraded accounts.
Great, good to know.

Please use the default version of the code which auto switches between http and https.
I've written a patch for the drupal statcounter module which does a serverside test for https rather than via javascript, like so:

Code:
     $inline_script = 'var sc_project=' . $id . ';';
     $inline_script .= 'var sc_invisible=' . $invisibility . ';';
     $inline_script .= 'var sc_security="' . $security_code . '";';
     $link = 'statcounter.com/counter/counter.js';
     $url_scheme = ($is_https) ? 'https://secure.' : 'http://www.';
     $correct_link = $url_scheme . $link;
I'm waiting for it to be tested by users before I make the final commit. Any feedback would be appreciated.

Thanks

Hi kdebass.
Is there a module for Drupal 8?
No, there is no module for Drupal 8 in the pipeline for the moment.

Cheers
 
Top