Giter Site home page Giter Site logo

angulartics-piwik's Introduction

angulartics-piwik

Bower version

Piwik plugin for angulartics

Install

First make sure you've read installation and setup instructions for Angulartics.

Then you can install this package either with npm or with bower.

npm

npm install --save angulartics-piwik

Bower

bower install --save angulartics-piwik

Add the <script> to your index.html:

<script src="/bower_components/angulartics-piwik/dist/angulartics-piwik.min.js"></script>

Then add angulartics.piwik to your module:

angular.module('myApp', ['angulartics', 'angulartics.piwik'])

Next, set the piwik tracker code as you would normally with piwik somewhere on your page, per piwik's tracking javascript guide:

<!-- Piwik -->
<script type="text/javascript">
  var _paq = _paq || [];
  // _paq.push(['trackPageView']);
  _paq.push(['enableLinkTracking']);
  (function() {
    var u="//{$PIWIK_URL}/";
    _paq.push(['setTrackerUrl', u+'piwik.php']);
    _paq.push(['setSiteId', {$IDSITE}]);
    var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
    g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
  })();
</script>
<noscript><p><img src="//piwik.yourdomain.com/piwik.php?idsite={$IDSITE}" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code -->

In this tracking code, {$PIWIK_URL} would be replaced by your piwik URL and {$IDSITE} would be replaced by the idsite of the website you are tracking in piwik.

NOTE: Make sure that you remove or comment the initial pageview tracking line (_paq.push(['trackPageView']);), as shown in the code snippet above. Angulartics will track the page automatically when the first state is loaded, so this initial page track is unnecessary.

That's it! Refer to the angulartics docs for more details on the basic tracking functions.

NOTE: If Piwik does not register your routes properly, check the Page URL fragments tracking setting and enable Keep Page URL fragments when tracking Page URLs as described in Piwik's FAQs.

API

piwik specific trackers. For more details on this functions, see the piwik JavaScript Tracking Client API docs

###setCustomVariable(index, name, value, [scope])

Set a custom variable. scope can be either 'visit' or 'page'. Defaults to 'page'.

###trackSiteSearch(keyword, [category], [count])

Log an internal site search for a specific keyword, in an optional category, specifying the optional count of search results in the page.

###trackGoal(goalID, [revenue])

Manually log a conversion for the numeric goal ID, with an optional numeric custom revenue customRevenue

###setUsername(username)

Default angulartics page and event tracking

Unsupported angulartics trackers

The following angulartics tracker functions have no piwik equivalent, and as such, are not supported. You can use setCustomVariable() with a 'visit' scope for per-user properties

$analytics.setAlias(alias)
$analytics.setUserProperties(properties)
$analytics.setSuperProperties(properties)

What else?

See more docs and samples at http://angulartics.github.io.

Development

Build

grunt uglify

License

MIT

angulartics-piwik's People

Contributors

inolasco avatar

Watchers

 avatar

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.