Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alternative async tracking snippet #45

Open
p0358 opened this issue Oct 1, 2017 · 4 comments
Open

Alternative async tracking snippet #45

p0358 opened this issue Oct 1, 2017 · 4 comments

Comments

@p0358
Copy link

p0358 commented Oct 1, 2017

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?

@jehna
Copy link
Owner

jehna commented Oct 2, 2017

Sounds good, this could be a part of the README.

No, ga-lite does not currently report page load times. Opened issue #46 for that.

@Jos512
Copy link

Jos512 commented Jan 10, 2018

This alternative syncing code is working for me.

Is there a particular reason why it hasn't been added to the README in the last months? I don't know enough JavaScript to know whether this is a good approach for production or not. I'd rather not use something that's 'frowned upon'. 😄

@jehna
Copy link
Owner

jehna commented Jan 10, 2018

The reason is only that the loading script is subject to small changes when #46 is implemented, so I haven't added it in yet 😄

The script from @p0358 translates directly to the current script found in readme, so it's perfectly safe to use.

@Jos512
Copy link

Jos512 commented Jan 11, 2018

Thanks for your quick reply. Good to know this code approach is good to use.

(Also thanks for your work on the ga-lite project as a whole. It's pretty amazing. 😄 )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants