Skip to content

Commit

Permalink
1.0.5
Browse files Browse the repository at this point in the history
* console scroll fix
* console sets existing plugins on load

Omniture plugin
* options bugfix
  • Loading branch information
Ryan Brewster committed Oct 29, 2014
1 parent d8db606 commit 3672323
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 38 deletions.
26 changes: 22 additions & 4 deletions lib/atrackt.console.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 16 additions & 15 deletions lib/plugins/atrackt.omniture.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions src/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
### CHANGE LOG
###### 1.0.5
* console scroll fix
* console sets existing plugins on load

###### 1.0.4
* console loads after document ready and collects all existing element
* console now has scrolling support on hover
Expand Down
12 changes: 9 additions & 3 deletions src/atrackt.console.coffee
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
###
Atrackt Tracking Library
https://github.com/brewster1134/atrackt
@version 1.0.2
@version 1.0.5
@author Ryan Brewster
###

Expand Down Expand Up @@ -46,6 +46,7 @@ https://github.com/brewster1134/atrackt
$('#atrackt-location', @$console).text @_getLocation()
$('body').addClass('atrackt-console').prepend @$console

@_setPlugins()
@_renderConsoleElements()

# Override the custom class to just log tracking data to the console
Expand All @@ -59,6 +60,11 @@ https://github.com/brewster1134/atrackt
plugin.send = (data, options) ->
console.log plugin.name, data, options

_setPlugins: ->
for pluginName, plugin of @plugins
unless plugin._send
@setPlugin pluginName, plugin

# Re-render console elements
#
_renderConsoleElements: ->
Expand Down Expand Up @@ -129,9 +135,9 @@ https://github.com/brewster1134/atrackt
offset:
top: -300
else if @ == $trackEl[0]
self.$console.scrollTo $rowEl, 0
self.$console.scrollTo $rowEl, 0,
offset:
top: -50
top: -100
, ->
$rowEl.removeClass 'atrackt-console-active'
$trackEl.removeClass 'atrackt-console-active'
3 changes: 3 additions & 0 deletions src/plugins/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
* Just a simple send method!

##### Omniture Plugin
###### 1.0.5
* options bugfix

###### 1.0.0
* updated to new api

Expand Down
34 changes: 18 additions & 16 deletions src/plugins/atrackt.omniture.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,37 @@
Atrackt Omniture Plugin
https://github.com/brewster1134/atrackt
@author Ryan Brewster
@version 1.0.2
@version 1.0.5
###

((root, factory) ->
if typeof define == 'function' && define.amd
define [
'jquery'
'atrackt'
], (Atrackt) ->
factory Atrackt
], ($, Atrackt) ->
factory $, Atrackt
else
factory Atrackt
) @, (Atrackt) ->
factory $, Atrackt
) @, ($, Atrackt) ->

window.Atrackt.setPlugin 'omniture',
send: (data, options) ->
return console.error 'ATRACKT ERROR: PLUGIN `omniture` - Site catalyst library not loaded' if typeof s == 'undefined'

$.extend true, @options, options
data._categories = data._categories?.join @options.delimiters.category
data = @translatePropMap data
data = @_translatePropMap data

@buildSObject data
if options.page && s.t?
@_buildSObject data
if @options.page && s.t?
s.t()
else if s.tl?
arg = if options.el?.attr('href')
options.el[0]
arg = if @options.el?.attr('href')
@options.el[0]
else
true
s.tl arg, options['trackingType'], @buildLinkName data
s.tl arg, @options['trackingType'], @_buildLinkName data
data

options:
Expand All @@ -48,7 +50,7 @@ https://github.com/brewster1134/atrackt
_event : 'prop4'

# omniture specific
buildSObject: (obj) ->
_buildSObject: (obj) ->
switch @options.version
when 14
linkTrackVars = @options.linkTrackVars
Expand All @@ -61,7 +63,7 @@ https://github.com/brewster1134/atrackt
s.contextData = obj
s

buildLinkName: (obj) ->
_buildLinkName: (obj) ->
linkName = [
obj[@options.propMap._location]
obj[@options.propMap._categories]
Expand All @@ -70,15 +72,15 @@ https://github.com/brewster1134/atrackt

linkName.join(@options.delimiters.linkName)

translatePropMap: (obj) ->
_translatePropMap: (obj) ->
return obj if @options.version > 14

_globalData = {}
$.each obj, (k,v) =>
_globalData[@keyLookup k] = v?.toString().replace? @options.charReplaceRegex, ''
_globalData[@_keyLookup k] = v?.toString().replace? @options.charReplaceRegex, ''
_globalData

keyLookup: (key) ->
_keyLookup: (key) ->
_newKey = @options.propMap[key]
console.error "ATRACKT ERROR: PLUGIN `omniture` - No mapping for `#{key}` in omniture config" unless _newKey
_newKey || key

0 comments on commit 3672323

Please sign in to comment.