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

script tag in index.html #90

Open
matthias-k opened this issue Oct 5, 2018 · 2 comments
Open

script tag in index.html #90

matthias-k opened this issue Oct 5, 2018 · 2 comments

Comments

@matthias-k
Copy link

Hi,

we are in the process of enabling our ember app for fastboot. So far it works very well when using ember serve, but it's not yet working with fastboot-app-server: We have a script tag in our index.html to load google analytics as suggested from google at https://developers.google.com/analytics/devguides/collection/analyticsjs/

<!-- Google Analytics -->
<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-XXXXX-Y', 'auto');
</script>
<!-- End Google Analytics -->

When using ember server we can then later on access the ga object as window.ga but when accessing the page via fastboot-app-server, this results in TypeError: window.ga is not a function. Can you help me fix this or just indicate where I missed something in the docs? I would be very grateful for your help!

@abhinavk96
Copy link

Any updates/work-around for this?

@snewcomer
Copy link

In general you need to worry about accessing window on node in a running app will error. One option is to block the ga function call if window is not present

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

No branches or pull requests

3 participants