angulartics / angulartics-google-analytics

Google Analytics plugin for Angulartics
MIT License
133 stars 86 forks source link

Confused about the setup of the project #86

Closed shenkev closed 7 years ago

shenkev commented 7 years ago

Quick question about how the project is assumed to be setup. We aren't using the node_module "angular". Instead we're pulling Angular from the web in index.html. Will this not work?

Right now we start our app using "node server.js" which serves index.html.

Index.html looks something like:

<html ng-app="myApp">
<head>
...
<script src="app.js"></script>
...
</head>
</html>

Index.html imports app.js and app.js looks something like:

var app = angular.module('myApp', ['ngMaterial', 'ngRoute', 'ngMessages'])
...

I'm a little confused because the instructions for setting up with npm say you need to call "require('angulartics')" which I assumed is done in app.js for our case. However, we can't call require there since it's client-side js?

timelf123 commented 7 years ago

the require instructions assume you are using a module loader like webpack on the frontend. you are able to use angulartics just fine without it, just include

<script src="path/to/angulartics.js"></script> in your html and inject 'angulartics'

do this for any other modules you need (angulartics-google-analytics, etc)