Nefarious Planetary Meddling

    @docomodigital/js-analytics

    3.0.2 • Public • Published

    js-analytics

    npm version

    js-analytics is a interface for Google Analytics to tracking events, pageviews and custom dimensions

    Usage

    import JsAnalytics from '@docomogital/js-analytics'
    // init JsAnalytics and set 'User' custom dim to slot #3 and 'Valuable' to slot #4
    JsAnalytics.init({
    	enabled: true,
    	/* if you pass analyticsID, analytics-adapter call ga('create') for you */
        analyticsID: 'UA-123456789-1',
    	logger: console,
    	dimensions: {
    		User: 3,
    		Valuable: 4
    	}
    });
    
    // set 'User' custom dim, without re-specify the slot
    JsAnalytics.setDimension({
    	User: 'logged'
    });
    
    // track pageview
    JsAnalytics.trackPage({
    	page: '/home',
    	title: 'Home Page',
    	dimensions: {
    		Valuable: false
    	}
    });
    
    // track event
    JsAnalytics.trackEvent({
    	category: 'Social',
    	action: 'Click',
    	label: 'Facebook',
    	value: 3,
    	dimensions: {
    		Valuable: true
    	}
    });

    Installation

    NPM

    npm install --save @docomogital/js-analytics

    Documentation

    To read documentation, go to:

    http://docomodigital.github.io/js-utils/js-analytics/latest

    Install

    npm i @docomodigital/js-analytics

    DownloadsWeekly Downloads

    0

    Version

    3.0.2

    License

    MIT

    Unpacked Size

    34.5 kB

    Total Files

    20

    Last publish

    Collaborators

    • everdrone
    • blame_etc