Last active
          December 21, 2015 07:18 
        
      - 
      
- 
        Save 7LayersDesign/6269715 to your computer and use it in GitHub Desktop. 
    Tracking function.
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | _doTracking: function(tag){ | |
| var cacheBuster = (new Date()).getTime(), | |
| $body = $('body'), | |
| $tracker = $('#dynamic-tracking'); | |
| tag += "&cb=$timestamp$"; | |
| // Select or create tracking image | |
| if( $tracker.length > 0 ) { | |
| // Updated existing element | |
| $tracker.attr('src', tag.replace(/\$timestamp\$/, cacheBuster)); | |
| } else { | |
| // Create new img tag in page | |
| $tracker = $('<img/>'); | |
| $tracker.attr('id', "dynamic-tracking"); | |
| $tracker.attr('src', tag.replace(/\$timestamp\$/, cacheBuster)); | |
| $tracker.css({"display":"none"}); | |
| $body.append($tracker); | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment