Skip to content

Commit

Permalink
Merge pull request #114 from ets-berkeley-edu/COL-360
Browse files Browse the repository at this point in the history
COL-360 - Track deep linking activities
  • Loading branch information
simong committed Oct 1, 2015
2 parents d9d93f7 + 5c46a63 commit 667c9e7
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion public/app/assetlibrary/assetLibraryService.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

'use strict';

angular.module('collabosphere').service('assetLibraryService', function($state, utilService) {
angular.module('collabosphere').service('assetLibraryService', function($state, analyticsService, utilService) {

// Get the parent container's hash. In case a hash a present, restore the state to allow
// for deep linking to an asset or asset library search
Expand All @@ -42,10 +42,27 @@
// Check if an asset was deep linked
if (data.asset) {
var assetId = parseInt(data.asset, 10);

// Track the asset deep link
analyticsService.track('Deep link asset', {
'asset_id': assetId,
'referer': document.referrer
});

$state.go('assetlibrarylist.item', {'assetId': assetId});

// Check if an asset library search was deep linked
} else if (data.keywords || data.category || data.user || data.type) {

// Track the asset library search deep link
analyticsService.track('Deep link Asset Library search', {
'asset_search_keywords': data.keywords,
'asset_search_category': data.category,
'asset_search_user': data.user,
'asset_search_types': data.type,
'referer': document.referrer
});

var searchOptions = {
'keywords': (data.keywords ? data.keywords : ''),
'category': (data.category ? data.category : ''),
Expand Down

0 comments on commit 667c9e7

Please sign in to comment.