Hi there, I’m a novice when it comes to python and anvil.
I’m following this article exactly but I keep running into the following error:
Here is the project URL: Knack 4 Freedback
I’m trying to add Segment’s JS library, identify a user, and send a track event on button submit (following the article exactly).
The JS library loads fine as I can see the .page event in Segment, but when I try to submit the button and send a .track event, I get an error in Anvil.
Here is my Anvil code (using the feedback project), can someone please help me understand what I may be doing wrong?
from ._anvil_designer import feedbackformTemplate from anvil import * import anvil.server import anvil.tables as tables import anvil.tables.query as q from anvil.tables import app_tables from anvil.js.window import analytics class feedbackform(feedbackformTemplate): def __init__(self, **properties): # Set Form properties and Data Bindings. self.init_components(**properties) # Any code you write here will run when the form opens. def submit_button_click(self, **event_args): # NEW line: analytics.track("Feedback submitted") name = self.name_box.text email = self.email_box.text feedback = self.feedback_box.text anvil.server.call('add_feedback', name, email, feedback) Notification("We have recorded your feedback, and sent an email to the owner of this app.", title="Thanks!").show() self.clear_inputs() def clear_inputs(self): self.name_box.text = "" self.email_box.text = "" self.feedback_box.text = ""
Please help!! Thanks everyone.