From 5c46a63d9c3949ef7f1a4ed4604b6b05892582f8 Mon Sep 17 00:00:00 2001 From: Nicolaas Matthijs Date: Wed, 30 Sep 2015 15:17:17 -0700 Subject: [PATCH] COL-360 - Track deep linking activities --- .../app/assetlibrary/assetLibraryService.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/public/app/assetlibrary/assetLibraryService.js b/public/app/assetlibrary/assetLibraryService.js index 541c3e6b..60b288d5 100644 --- a/public/app/assetlibrary/assetLibraryService.js +++ b/public/app/assetlibrary/assetLibraryService.js @@ -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 @@ -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 : ''),