Skip to content

Commit

Permalink
added site speed option
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul van der Linden committed May 12, 2011
1 parent c734523 commit 96fb8de
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
43 changes: 43 additions & 0 deletions googletools/migrations/0002_auto__add_field_analyticscode_speed.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models

class Migration(SchemaMigration):

def forwards(self, orm):

# Adding field 'AnalyticsCode.speed'
db.add_column('googletools_analyticscode', 'speed', self.gf('django.db.models.fields.BooleanField')(default=False), keep_default=False)


def backwards(self, orm):

# Deleting field 'AnalyticsCode.speed'
db.delete_column('googletools_analyticscode', 'speed')


models = {
'googletools.analyticscode': {
'Meta': {'ordering': "('site', 'code')", 'object_name': 'AnalyticsCode'},
'code': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'site': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['sites.Site']", 'unique': 'True'}),
'speed': ('django.db.models.fields.BooleanField', [], {'default': 'False'})
},
'googletools.siteverificationcode': {
'Meta': {'ordering': "('site', 'code')", 'object_name': 'SiteVerificationCode'},
'code': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'site': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['sites.Site']", 'unique': 'True'})
},
'sites.site': {
'Meta': {'ordering': "('domain',)", 'object_name': 'Site', 'db_table': "'django_site'"},
'domain': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
}
}

complete_apps = ['googletools']
1 change: 1 addition & 0 deletions googletools/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
class AnalyticsCode(models.Model):
site = models.ForeignKey(Site, verbose_name=_('site'), unique=True)
code = models.CharField(_('code'), max_length=100)
speed = models.BooleanField(verbose_name=_('track speed'), default=False)

def __unicode__(self):
return self.code
Expand Down
1 change: 1 addition & 0 deletions googletools/templates/googletools/analytics_code.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '{{ analytics_code }}']);
_gaq.push(['_trackPageview']);
{% if analytics_code.speed %}_gaq.push(['_trackPageLoadTime']);{% endif %}

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
Expand Down

0 comments on commit 96fb8de

Please sign in to comment.