@ovh-ux/ng-at-internet-ui-router-plugin
v3.5.0
Published
Plugin for at-internet when using UI-Router
Downloads
70
Readme
ng-at-internet-ui-router-plugin
Plugin for AT Internet when using UI-Router.
Install
$ yarn add @ovh-ux/ng-at-internet-ui-router-plugin
Usage
import angular from 'angular';
import ngAtInternetUiRouterPlugin from '@ovh-ux/ng-at-internet-ui-router-plugin';
angular.module('myApp', [ngAtInternetUiRouterPlugin]);
Follow at-internet installation In your web page:
<script src="angular.js"></script>
<script src="smarttag-yourproject.js"></script>
<script src="dist/umd/ng-at-internet.js"></script>
<script src="dist/umd/ng-at-internet-ui-router-plugin.js"></script>
Examples
Please see at-internet documentation: link
Configuring the provider:
app.config([
'atInternetUiRouterPluginProvider',
function(provider) {
provider.setTrackStateChange(true);
},
]);
That's it, now every state change will send a page tracking data to ATInternet. To disabled tracking on specific states, use the following syntax:
$stateProvider.state('your-untracked-state', {
url: '...',
atInternet: {
ignore: true, // this tell AtInternet to not track this state
},
});
By default, the state name will be used for the page name to be sent. If you want to modify this behavior for a given state, please use the following syntax :
$stateProvider.state('your-state', {
url: '...',
atInternet: {
rename: 'foobar', // use "foobar" as page name instead of "your-state"
},
});
If you want, you can apply some filters on the states name, for example :
app.config(
/* @ngInject */ (atInternetUiRouterPluginProvider) => {
// replace all occurrences of "foo" by "bar" in states name
atInternetUiRouterPluginProvider.addStateNameFilter((stateName) =>
stateName.replace(/foo/g, 'bar'),
);
},
);
Test
$ yarn test
Related
- ng-at-internet - AT Internet tracking js library wrapper for AngularJS
Contributing
Always feel free to help out! Whether it's filing bugs and feature requests or working on some of the open issues, our contributing guide will help get you started.
License
BSD-3-Clause © OVH SAS