Esempio n. 1
0
def enquiry(request):
    form = EnquiryForm(request.POST or None)
    
    if request.method == 'POST' and form.is_valid():
        enquiry = form.save(commit = False)
        spam = enquiry.check_for_spam(request)
        enquiry.save(notify = not spam)
        
        if 'bambu_analytics' in settings.INSTALLED_APPS:
            from bambu_analytics import track_event, events
            track_event(request, events.EVENT,
                category = u'Enquiry',
                action = u'Submit',
                option_label = enquiry.subject,
                option_value = enquiry.pk
            )
        
        return HttpResponseRedirect(
            'thanks/?%s' % urlencode(
                {
                    'next': request.GET.get('next', '/')
                }
            )
        )
    
    return TemplateResponse(
        request,
        'enquiries/enquiry.html',
        {
            'form': form,
            'menu_selection': 'enquiry',
            'next': request.GET.get('next', '/')
        }
    )
 def test_track_transaction_item(self):
     request = self.factory.get('/')
     track_event(request, events.TRANSACTION_ITEM,
         transaction_id = 1,
         sku = '12345',
         product = 'Test Product',
         category = u'test',
         amount = 1.0,
         quantity = 1
     )
 def test_track_transaction(self):
     request = self.factory.get('/')
     track_event(request, events.TRANSACTION,
         transaction_id = 1,
         store = 'test',
         amount = 1.0,
         tax = 0,
         postage = 0,
         city = 'Birmingham',
         state = 'West Midlands',
         country = 'United Kingdom'
     )
 def test_track_page(self):
     request = self.factory.get('/')
     track_event(request, events.PAGE)
 def test_track_event(self):
     request = self.factory.get('/')
     track_event(request, events.EVENT,
         category = 'test',
         action = 'event'
     )
Esempio n. 6
0
	def process_request(self, request):
		if not add_events_from_redirect(request):
			track_event(request, events.PAGE,
				url = request.path
			)