Skip to content

Commit

Permalink
Merge pull request #51 from justinsa/master
Browse files Browse the repository at this point in the history
Add noninteraction parameter for ga.js event tracking
  • Loading branch information
Julien Bouquillon committed Nov 24, 2014
2 parents 3055c1a + e75b74e commit 9441904
Show file tree
Hide file tree
Showing 4 changed files with 366 additions and 225 deletions.
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ module.exports = function(grunt) {
jshint: {
files: ['Gruntfile.js', 'src/*.js', 'test/unit/*.js'],
options: {
curly: false,
curly: true,
browser: true,
eqeqeq: true,
immed: true,
Expand Down
90 changes: 45 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ var app = angular.module('app', ['angular-google-analytics'])
// track all routes (or not)
AnalyticsProvider.trackPages(true);

//Optional set domain (Use 'none' for testing on localhost)
//AnalyticsProvider.setDomainName('XXX');
// Optional set domain (Use 'none' for testing on localhost)
// AnalyticsProvider.setDomainName('XXX');

//Use display features plugin
// Use display features plugin
AnalyticsProvider.useDisplayFeatures(true);

// url prefix (default is empty)
Expand All @@ -58,19 +58,19 @@ var app = angular.module('app', ['angular-google-analytics'])
// Ignore first page view... helpful when using hashes and whenever your bounce rate looks obscenely low.
AnalyticsProvider.ignoreFirstPageLoad(true);

//Enabled eCommerce module for analytics.js(uses legacy ecommerce plugin)
AnalyticsProvider.useECommerce(true,false);
// Enabled eCommerce module for analytics.js(uses legacy ecommerce plugin)
AnalyticsProvider.useECommerce(true, false);

//Enabled eCommerce module for analytics.js(uses ec plugin instead of ecommerce plugin)
AnalyticsProvider.useECommerce(true,true);
// Enabled eCommerce module for analytics.js(uses ec plugin instead of ecommerce plugin)
AnalyticsProvider.useECommerce(true, true);

//Enable enhanced link attribution
// Enable enhanced link attribution
AnalyticsProvider.useEnhancedLinkAttribution(true);

//Enable analytics.js experiments
// Enable analytics.js experiments
AnalyticsProvider.setExperimentId('12345');

//Set custom cookie parameters for analytics.js
// Set custom cookie parameters for analytics.js
AnalyticsProvider.setCookieConfig({
cookieDomain: 'foo.example.com',
cookieName: 'myNewName',
Expand Down Expand Up @@ -111,55 +111,55 @@ var app = angular.module('app', ['angular-google-analytics'])
Analytics.addImpression(productId, name, list, brand, category, variant, position, price);
Analytics.pageView();
// example:
Analytics.addImpression('sku-1','Test Product 1','Category List','Brand 1','Category-1','variant-1','1','24990');
Analytics.addImpression('sku-2','Test Product 2','Category List','Brand 2','Category-1','variant-3','2','2499');
Analytics.addImpression('sku-1', 'Test Product 1', 'Category List', 'Brand 1', 'Category-1', 'variant-1', '1', '24990');
Analytics.addImpression('sku-2', 'Test Product 2', 'Category List', 'Brand 2', 'Category-1', 'variant-3', '2', '2499');
Analytics.pageView();

// Product Click Tracking
Analytics.addProduct(productId,name,category,brand,variant,price,quantity,coupon,position);
Analytics.addProduct(productId, name, category, brand, variant, price, quantity, coupon, position);
Analytics.productClick(listName);
// example:
Analytics.addProduct('sku-2','Test Product 2','Category-1','Brand 2','variant-3','2499','1','FLAT10','1');
Analytics.addProduct('sku-2', 'Test Product 2', 'Category-1', 'Brand 2', 'variant-3', '2499', '1', 'FLAT10', '1');
Analytics.productClick('Search Result');

// Product Detail Tracking
Analytics.addProduct(productId,name,category,brand,variant,price,quantity,coupon,position);
Analytics.addProduct(productId, name, category, brand, variant, price, quantity, coupon, position);
Analytics.trackDetail();
// example:
Analytics.addProduct('sku-2','Test Product 2','Category-1','Brand 2','variant-3','2499','1','FLAT10','1');
Analytics.addProduct('sku-2', 'Test Product 2', 'Category-1', 'Brand 2', 'variant-3', '2499', '1', 'FLAT10', '1');
Analytics.trackDetail();

// Add to cart Tracking
Analytics.addProduct(productId,name,category,brand,variant,price,quantity,coupon,position);
Analytics.addProduct(productId, name, category, brand, variant, price, quantity, coupon, position);
Analytics.trackCart('add');
// example:
Analytics.addProduct('sku-2','Test Product 2','Category-1','Brand 2','variant-3','2499','1','FLAT10','1');
Analytics.addProduct('sku-2','Test Product 2','Category-1','Brand 2','variant-3','2499','1','FLAT10','1');
Analytics.addProduct('sku-2', 'Test Product 2', 'Category-1', 'Brand 2', 'variant-3', '2499', '1', 'FLAT10', '1');
Analytics.addProduct('sku-2', 'Test Product 2', 'Category-1', 'Brand 2', 'variant-3', '2499', '1', 'FLAT10', '1');
Analytics.trackCart('add');

// Remove from cart Tracking
Analytics.addProduct(productId,name,category,brand,variant,price,quantity,coupon,position);
Analytics.addProduct(productId, name, category, brand, variant, price, quantity, coupon, position);
Analytics.trackCart('remove');
// example:
Analytics.addProduct('sku-2','Test Product 2','Category-1','Brand 2','variant-3','2499','1','FLAT10','1');
Analytics.addProduct('sku-2','Test Product 2','Category-1','Brand 2','variant-3','2499','1','FLAT10','1');
Analytics.addProduct('sku-2', 'Test Product 2', 'Category-1', 'Brand 2', 'variant-3', '2499', '1', 'FLAT10', '1');
Analytics.addProduct('sku-2', 'Test Product 2', 'Category-1', 'Brand 2', 'variant-3', '2499', '1', 'FLAT10', '1');
Analytics.trackCart('remove');

// Checkout Tracking
Analytics.addProduct(productId,name,category,brand,variant,price,quantity,coupon,position);
Analytics.trackCheckout(checkoutStep,optionValue);
Analytics.addProduct(productId, name, category, brand, variant, price, quantity, coupon, position);
Analytics.trackCheckout(checkoutStep, optionValue);
// example:
Analytics.addProduct('sku-2','Test Product 2','Category-1','Brand 2','variant-3','2499','1','FLAT10','1');
Analytics.addProduct('sku-2','Test Product 2','Category-1','Brand 2','variant-3','2499','1','FLAT10','1');
Analytics.trackCheckout(1,'Visa');
Analytics.addProduct('sku-2', 'Test Product 2', 'Category-1', 'Brand 2', 'variant-3', '2499', '1', 'FLAT10', '1');
Analytics.addProduct('sku-2', 'Test Product 2', 'Category-1', 'Brand 2', 'variant-3', '2499', '1', 'FLAT10', '1');
Analytics.trackCheckout(1, 'Visa');

// Transaction Tracking
Analytics.addProduct(productId,name,category,brand,variant,price,quantity,coupon,position);
Analytics.trackTransaction(transactionId,affiliation,revenue,tax,shipping,coupon,list,step,option);
Analytics.addProduct(productId, name, category, brand, variant, price, quantity, coupon, position);
Analytics.trackTransaction(transactionId, affiliation, revenue, tax, shipping, coupon, list, step, option);
// example:
Analytics.addProduct('sku-2','Test Product 2','Category-1','Brand 2','variant-3','2222','1','MEN10','1');
Analytics.addProduct('sku-2','Test Product 2','Category-1','Brand 2','variant-3','1111','1','WOMEN10','1');
Analytics.trackTransaction('T1234','Online Store - Web','3333','10','200','FLAT10','','','');
Analytics.addProduct('sku-2', 'Test Product 2', 'Category-1', 'Brand 2', 'variant-3', '2222', '1', 'MEN10', '1');
Analytics.addProduct('sku-2', 'Test Product 2', 'Category-1', 'Brand 2', 'variant-3', '1111', '1', 'WOMEN10', '1');
Analytics.trackTransaction('T1234', 'Online Store - Web', '3333', '10', '200', 'FLAT10', '', '', '');

// Promotion Impressions
Analytics.addPromo(productId, name, creative, position);
Expand All @@ -168,7 +168,7 @@ var app = angular.module('app', ['angular-google-analytics'])
Analytics.pageView();
// Note: Before tracking promotion Click, call pageView otherwise promotion impressions will be treated as promotion clicks
// example:
Analytics.addPromo('PROMO_1234','Summer Sale', 'summer_banner2', 'banner_slot1');
Analytics.addPromo('PROMO_1234', 'Summer Sale', 'summer_banner2', 'banner_slot1');
Analytics.pageView();

// Promotion Clicks
Expand All @@ -177,7 +177,7 @@ var app = angular.module('app', ['angular-google-analytics'])
Analytics.addPromo(promotionId, promotionName, creative, position);
Analytics.promoClick(promotionName);
// example:
Analytics.addPromo('PROMO_1234','Summer Sale', 'summer_banner2', 'banner_slot1');
Analytics.addPromo('PROMO_1234', 'Summer Sale', 'summer_banner2', 'banner_slot1');
Analytics.promoClick('Summer Sale');

// populate a custom dimension
Expand All @@ -193,29 +193,29 @@ var app = angular.module('app', ['angular-google-analytics'])
AnalyticsProvider.setAccount('UA-XXXXX-xx');
// automatic route tracking (default=true)
AnalyticsProvider.trackPages(false);
//Optional set domain (Use 'none' for testing on localhost)
// Optional set domain (Use 'none' for testing on localhost)
AnalyticsProvider.setDomainName('XXX');
//Use display features plugin
// Use display features plugin
AnalyticsProvider.useDisplayFeatures(true);
//Use analytics.js instead of ga.js
// Use analytics.js instead of ga.js
AnalyticsProvider.useAnalytics(true);
// Ignore first page view.
AnalyticsProvider.ignoreFirstPageLoad(true);
//Enable eCommerce module for analytics.js
AnalyticsProvider.useECommerce(true,false);
//Enable enhanced eCommerce module for analytics.js
AnalyticsProvider.useECommerce(true,true);
//Enable enhanced link attribution module for analytics.js or ga.js
// Enable eCommerce module for analytics.js
AnalyticsProvider.useECommerce(true, false);
// Enable enhanced eCommerce module for analytics.js
AnalyticsProvider.useECommerce(true, true);
// Enable enhanced link attribution module for analytics.js or ga.js
AnalyticsProvider.useEnhancedLinkAttribution(true);
//Enable analytics.js experiments
// Enable analytics.js experiments
AnalyticsProvider.setExperimentId('12345');
//Set custom cookie parameters for analytics.js
// Set custom cookie parameters for analytics.js
AnalyticsProvider.setCookieConfig({
cookieDomain: 'foo.example.com',
cookieName: 'myNewName',
cookieExpires: 20000
});
//Change the default page event name. This is useful for ui-router, which fires $stateChangeSuccess instead of $routeChangeSuccess
// Change the default page event name. This is useful for ui-router, which fires $stateChangeSuccess instead of $routeChangeSuccess
AnalyticsProvider.setPageEvent('$stateChangeSuccess');

```
Expand Down
Loading

0 comments on commit 9441904

Please sign in to comment.