Giter Site home page Giter Site logo

ga-lite's People

Contributors

benniemosher avatar brianteeman avatar dependabot-preview[bot] avatar dependabot[bot] avatar earthboundkid avatar gaearon avatar github-actions[bot] avatar guifromrio avatar haggen avatar jehna avatar jsibbiso avatar kidonng avatar lukasdrgon avatar rtpharry avatar sikanderiqbal avatar simoncropp avatar waldyrious avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ga-lite's Issues

Not sure if I'm installing it right!

Hi Jesse, I know that its not an issue, but I'm not sure what I'm doing wrong!?
I have wordpress site and I'm required to make the Google pagespeed 100/100, so I've searched everywhere and came across your plugin.
As you mentioned I copied the code you posted to the body of my site and I added the google analytics tracking code which is UA-XXXXXXXX-X. The score is still the same, can you please tell me if theres something I'm missing or should do ?

Thanks a lot

YSlow hit

Original GA is reported as Leverage browser caching on both GT Metrics and pingdom ,
with ga-lite the hit is moved from PageSpeed to YSlow so you are getting hit either way

http://i.prntscr.com/6EctdfeoQnGYtfyyOejfcw.png

Scores with Google Analytics

Speed: 98
YSlow: 86

with ga-lite

Speed: 99
YSlow: 84

No HTTP response detected

Hi there (I hope this is the right place to raise issues),

I was using v1 of ga-lite and was extremely pleased.
I admit I don't check my analytics too often, and yesterday I've found out Google says my site is not using the needed code for several months now. So I came back here and found out there's a new version.

I've replaced v1 code with the v2 one, but I'm getting a red result from the Google Tag Assistant's Chrome addon, with the following errors:

  1. No HTTP response detected
  2. Missing analytics.js script

Now, I can realize the missing js ofcourse hence the 2nd error should be ignored, as we're using galite.js, but can the 1st error be ignored as well?

TIA,
David.

PS: This is the site I'm using ga-lite on is if you need to look at the code.

Features Available? ECommerce and Block Yourself from Analytics

Hi
just a great code to get better results in Page Insights.

Is it possible to add the option to track Ecommerce conversions ? Because it is not getting any data from client purchases.

I want to know if its possible too for the Google Addon "Block Yourself from analytics" to block the traffic from the addon , because i do many changes and test during the day in my store and it's always getting traffic from that location that i do the changes.

Many thanks ,
waiting your feedback

Automatic version builds

Should include some kind of bot to automatically build the versions, like Rultor.

This is, so the correct versioning of the files would not be eligible for a human error

GA-lite via RequireJS

Hi there, trying to get ga-lite running via RequireJS. Have this code in my main.js file (obviously my-ua-account-no is really my account number):

require(['galite'], function()
{
    var galite = galite || {};
    galite.UA = 'my-ua-account-no';
    galite.anonymizeIp = true;
});

It seems when the request is made to https://www.google-analytics.com/collect? the tid value is undefined- any idea why this is happening?

ga-lite public API

So this project can be easily extended, the library should expose a public API that a user can call.

Similarly like the official analytics.js exposes the ga() function, ga-lite should have some kind of public API that can be called when an event has fired.

Anonymize IP Adress

Add a function to anonymize ip adress. Guess should be something like

ga('create', 'UA-XXXXXXX-X', 'website.de');
ga('set', 'anonymizeIp', true);
ga('send', 'pageview');

2.0 is not backwards-compatible with 1.x

The 1.x version is currently in use with 43M hits/month from jsDelivr. This provides us with an issue, since the old jsDelivr link did have the latest tag as default – so upgrading to 2.0 version would brake thousands of analytics on websites.

ga-lite doesn't track when Google Analytics does ('Do not track' difference)

Earlier this week I added ga-lite to my website and it worked. Or perhaps it seemed to work, because today it doesn't create a call to www.google-analytics.com. If I replace ga-lite with the Google Analytics JavaScript code, there is a call to www.google-analytics.com.

Ga-lite code

Code I tried:

<script>
window.galite=window.galite||function(){(galite.q=galite.q||[]).push(arguments)};
galite('create', 'UA-12345678-1');
galite('set', 'anonymizeIp', true);
galite('send', 'pageview');
</script>

// ...

<script async defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/ga-lite.min.js"></script>

And:

<script>
(function(e,t,n,i,s,a,c){e[n]=e[n]||function(){(e[n].q=e[n].q||[]).push(arguments)}
;a=t.createElement(i);c=t.getElementsByTagName(i)[0];a.async=true;a.src=s
;c.parentNode.insertBefore(a,c)
})(window,document,"galite","script","https://cdn.jsdelivr.net/npm/ga-lite@2/dist/ga-lite.min.js");

galite('create', 'UA-12345678-1', 'auto');
galite('send', 'pageview');
</script>

I do see that the script from cdn.jsdelivr.net loads in both Firefox and Chrome. But there isn't a resulting call to www.google-analytics.com to actually send the data to Google Analytics. (I of course verified that I don't have a browser setting that blocks requests to that address.)

I neither see an error message appearing in the 'Console' of the webdeveloper tools of Firefox and Chrome. (I tried both browsers.)


This issue does not only happen on my localhost test website. Here is a speedtest of Jehna's website that shows a HTTP connection error for the request to www.google-analytics.com. This is another speedtest for the same page, but this time from Melbourne. Here the connection error also shows.

I checked Google's Google Analytics status and there were no problems at this time.


Google Analytics

The issue does not happen with this:

<script>
    window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
    ga('create', 'UA-12345678-1', 'auto');
    ga('send', 'pageview');
    ga('set', 'anonymizeIp', true);
</script>

<script async defer src="https://www.google-analytics.com/analytics.js"></script>

For this code I see a call to Google Analytics:

https://www.google-analytics.com/collect?v=1&_v=j66&aip=1&a=1122917586&t=timing&_s=2&dl=http%3A%2F%2Flocalhost%2F&ul=nl&de=UTF-8.....

This happens to me in the same browser on the same computer, so I think we can rule out that my computer or browser has trouble connecting to www.google-analytics.com.

Add onunload event tracking

The v1 implemented the onunload event by default to correct the time spent on page (especially on bounces).

The original code:

var pageLoadedTimestamp = new Date().getTime();

/**
 * Note:
 * unload event does not fire on:
 * - Android chrome on tab closing
 */
window.addEventListener(
    'unload',
    eventBuilder(
        'timing',
        {
            'utc': 'JS Dependencies',
            'utv': 'unload',
            'utt': (new Date().getTime() - pageLoadedTimestamp)
        }
    )
);

Disableing of ga-lite through cookie

I have a privacy concern about the code-snippet. Even if it's following browsers tracking-choice, it is not enough for european websites, to use the code.
According to the GDPR User has to get a choice, to manually disable Tracking.
I used GA-Lite within a website, and discovered, that the opt-out-plugin does not work.

Can anybody help, how to change the opt-out-cookie-code, that it will work with GDPR and go-lite? Thanks!

// Set to the same value as the web property used on the site
var gaProperty = 'UA-XXXXXXX-X';
	
// Disable tracking if the opt-out cookie exists.
var disableStr = 'ga-disable-' + gaProperty;
if (document.cookie.indexOf(disableStr + '=true') > -1) {
  window[disableStr] = true;
}
// Opt-out function for Google Analytics 
function gaOptout() {
  document.cookie = disableStr + '=true; expires=Thu, 31 Dec 2099 23:59:59 UTC; path=/';
  window[disableStr] = true;
}
</script>

Add note to README that pingdom tool shows error

For some reason the Google Analytics' endpoint gives connection error when sent from Pingdom's tool. (#50, #32, #53, #61)

We should add a "FAQ" section to the README and state that this is a known issue, and that everything is okay (it's just a cosmetic flaw).

HTTPS

The inline call to http://www.google-analytics.com/collect should use no protocol and just // so that it uses the protocol of the website that it is being used on.

Hot to set session timeout?

Hi there!
Thank you for you module!
I'd like to know hot to set the session timeout with ES6?
Now I make it in such way:

    <script>
        (function (i, s, o, g, r, a, m) {
            i['GoogleAnalyticsObject'] = r;
            i[r] = i[r] || function () {
                (i[r].q = i[r].q || []).push(arguments)
            }, i[r].l = 1 * new Date();
            a = s.createElement(o)
                , m = s.getElementsByTagName(o)[0];
            a.async = 1;
            a.src = g;
            m.parentNode.insertBefore(a, m)
        })(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
        ga('create', 'UA-xxx-1', 'auto');
        ga('send', 'pageview');		
			setTimeout(function() {
			ga("send", "event", "New Visitor", location.pathname)
        }, 15000);     		
    </script>

Denying cookies crashes the script

If your browser has cookies disabled, using localStorage throws an error that crashes ga-lite.

ga-lite should be able to work even without localstorage.

Are Conversion Tags Possible & Phone Number Tags

Hi,
Awesome project! Just noticing when trying to add the below conversion tags that it doesn't seem to work.

I know that you change 'gtag' to 'galite' in the below examples, but I just get errors in the console when trying to run these conversion tags.

Firstly AdWords ask you to add a tag like this if you already have analytics running (which I do as it's galite analytics).

But basically having no joy with the below set up as per the screenshot:
https://www.screencast.com/t/lUPDs4xS

And the raw code here for reference:
`<script>
(function(e,t,n,i,s,a,c){e[n]=e[n]||function(){(e[n].q=e[n].q||[]).push(arguments)}
;a=t.createElement(i);c=t.getElementsByTagName(i)[0];a.async=true;a.src=s
;c.parentNode.insertBefore(a,c)
})(window,document,"galite","script","https://cdn.jsdelivr.net/npm/ga-lite@2/dist/ga-lite.min.js");

    galite('create', 'UA-XXXXXXXX-X', 'auto');
    galite('send', 'pageview');
    galite('config', 'AW-930415418');
    galite('config', 'AW-930415418/n5jDCMeornAQuobUuwM', {
        'phone_conversion_number': '02 9939 xxxx'
    });
</script>`

Any ideas please?

Thanks.
Richard

Error from https://www.google-analytics.com/collect?

Alternative async tracking snippet

How about adding something like "Alternative async tracking snippet" from https://developers.google.com/analytics/devguides/collection/analyticsjs/ to docs?

I believe it could look something like this:

<script>
window.galite=window.galite||function(){(galite.q=galite.q||[]).push(arguments)};
galite('create', 'UA-XXXXX-Y', 'auto');
galite('send', 'pageview');
</script>
<script async src="https://cdn.jsdelivr.net/npm/ga-lite@2/dist/ga-lite.min.js"></script>

(caution: didn't test this)
Also, why doesn't it save the time on creating the placeholder galite fucntion? Does it not report page load time?

How about releasing an AMP Analytics version?

This plugin gets excellent reviews, but I've just realised that I am going to miss out because I've converted my WordPress to Native AMP on every page and no longer have regular Google analytics.

Will this be possible, at some point, please?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.