dhowe / Website

Website
2 stars 3 forks source link

Add/test analytics #238

Open dhowe opened 4 years ago

dhowe commented 4 years ago

are there decent analytics we can use other than google?

cqx931 commented 4 years ago

Two open source alternatives that can be installed locally. openwebanalytics: http://www.openwebanalytics.com/ countly: https://github.com/Countly/countly-server

cqx931 commented 4 years ago

Countly installation script assumes it is running on a fresh, decent Ubuntu/CentOS/RHEL Linux without any services listening on port 80 or 443 (which should also be open to incoming traffic), and takes care of every library and software required to be installed for Countly to run.

dhowe commented 4 years ago

[ON HOLD - BLOCKED BY #140 ]

Add this code to the relevant pages on the site (ignore Wordpress for now):

To track page views using Javascript, cut and paste this tracking tag into the HTML of your web pages. Learn more about how to use OWA's Javascript tracking API to track your web site and pages.

<!-- Start Open Web Analytics Tracker -->
<script type="text/javascript">
//<![CDATA[
var owa_baseUrl = 'https://rednoise.org/owa/';
var owa_cmds = owa_cmds || [];
owa_cmds.push(['setSiteId', '4b0abd7f174679a5dc058eb6ebdd336d']);
owa_cmds.push(['trackPageView']);
owa_cmds.push(['trackClicks']);

(function() {
    var _owa = document.createElement('script'); _owa.type = 'text/javascript'; _owa.async = true;
    owa_baseUrl = ('https:' == document.location.protocol ? window.owa_baseSecUrl || owa_baseUrl.replace(/http:/, 'https:') : owa_baseUrl );
    _owa.src = owa_baseUrl + 'modules/base/js/owa.tracker-combined-min.js';
    var _owa_s = document.getElementsByTagName('script')[0]; _owa_s.parentNode.insertBefore(_owa, _owa_s);
}());
//]]>
</script>
dhowe commented 4 years ago

Can we verify that there is tracking code on all the pages, including the new detail pages and the events ?

cqx931 commented 4 years ago

Yes, I can verify the tracking code on the new detail pages for the published site. By events do you mean the wordpress site?

dhowe commented 4 years ago

Yes. I'm not sure if we can use the same OWA instance for the wordpress

cqx931 commented 4 years ago

Just added it to the wordpress home page, can you check whether it works for OWA at all? Potentially it can also be added to all wordpress pages if needed.

dhowe commented 4 years ago

I don't see it, after also visiting it myself. I think something more may be required to get it working with wordpress. Did you read this?

Also, we need to figure out how to set the 'page-type' for each of the pages -- it is currently 'unset' everywhere.

Ping me when working again and I can give you access to owa

cqx931 commented 4 years ago

owa_cmds.push(['setPageType', 'Home']); doesn't seem to work as expected, related issues: https://github.com/Open-Web-Analytics/Open-Web-Analytics/issues/366

dhowe commented 4 years ago

perhaps it is bc our owa is not updated (see the messages on lower right in the admin ui) if you feel comfortable, try the updates...

dhowe commented 4 years ago

did you try: window.OWATracker.setPageType('your-page-type') ?

cqx931 commented 4 years ago

wpr works fine now, get stucked on setPageType. I have created a ticket for this in their github repo, will see if anyone answers there.

cqx931 commented 4 years ago

I think this is what we need for setPageType to work:

Go into the DB and alter it manually in the owa_document table. I think if you've visited the site before you added the owa command it won't update the site info and remain (not set) or whatever it is.