WotNot Help Center
Create a ticketBook a demoProduct
  • 👋Welcome!
  • 🏁Getting Started
    • Building a chatbot
    • Testing a chatbot
    • Publishing your bot
      • Web
        • Embed chatbots on website
      • WhatsApp
        • Meta
        • 360Dialog
        • Twilio
        • GupShup
        • TechAlpha
      • Instagram
      • Facebook Messenger
      • SMS
      • Mobile app
      • API
    • Utility Tools
    • Contacts
      • Scheduling a Contact Report
      • Exporting a Contact List
      • Blocking contacts
    • Chatbot Appearance
      • Custom CSS
      • Image dimensions
      • Pop-up messages
  • ⚒️Bot builder
    • Action blocks
      • Trigger
      • Send message
      • Collect input
      • Buttons
      • Reply buttons
      • Carousel
      • Agent
      • Answer AI
      • Set AI
      • Send an email
      • List
      • Condition
      • Talk to human
      • Dynamic data
      • Javascript
      • Collect file
      • Form
      • Webhook
      • Flow
      • Jump
      • Options
      • Calendar
      • Delay
      • Codeblock
      • Slider
      • Image gallery
      • Send WhatsApp
      • Send SMS
      • Send Email
      • Send Status
      • WhatsApp flow
      • Catalogue
    • Outbound bots
      • Building One Off Campaign
      • Building Ongoing Campaign
    • Variables
    • Cloning bots
    • Requesting edit access
    • Connecting action blocks
    • Creating a loop
  • ✨AI Studio
    • Building a GPT chatbot
    • Knowledge base
    • Custom Answers
    • Functions
    • Prompts
    • AI credits
    • Refresh frequency
  • 💬Live Chat
    • Overview
    • Building a bot with live chat
    • Creating views
    • Adding labels
    • Saved replies
    • Settings
  • 🔗Integrations
    • Overview
    • HTTP request
    • Ready integrations
      • Google Calendar
      • Google Sheets
      • Google Analytics
        • Using Javascript
      • Salesforce
      • HubSpot
      • Calendly
      • Slack
      • Airtable
      • Zendesk
      • Freshdesk
      • DialogFlow
      • Zoho CRM
    • Events
    • Zapier
    • Public APIs
  • 💬WhatsApp Business API
    • Getting a WhatsApp API
      • Getting WhatsApp API (Old approach)
      • Sandbox WhatsApp API
    • Facebook Business Manager (FBM) Verification
    • Creating a WhatsApp Template
    • Cost
    • Messaging Limits, Quality Rating
    • Official Business Account (Green tick verification)
  • 📊Reporting
    • Overview
    • Chatbot Report
    • Agent Report
    • Outbound Report
    • Link analytics
    • Weekly email report
  • 🛠️Troubleshooting
    • Getting notification for leads
    • JS functions to trigger chat widget
    • Opt-out management
    • Setting up link tracking
    • How do I hard refresh my browser?
    • Cookies
    • Notifications
    • Tracking Facebook Pixel
    • Setting up SSO login
    • Inviting teammates
    • Teams
  • 🧑‍💻Support
    • Creating a ticket
    • Book a demo
    • Purchasing a subscription
    • Cancelling a subscription
    • Refund policy
    • Reset password
    • Deleting account
Powered by GitBook
On this page
  • Step 1: Make sure that the Google Analytics 4 code snippet is present
  • Step 2: Add the Javascript block on the chatbot flow

Was this helpful?

  1. Integrations
  2. Ready integrations
  3. Google Analytics

Using Javascript

Overview on how to fire events on Google Analytics using the Javascript action block.

Step 1: Make sure that the Google Analytics 4 code snippet is present

In order to fire events to your measurement ID, you need to first make sure that the Google Analytics code snippet is already added to your website. Usually, website either add it manually on the code or using Google Tag Manager.

Step 2: Add the Javascript block on the chatbot flow

At the point in the chatbot flow when you want to fire an event, add the Javascript action block and input this code.

window.dataLayer = window.dataLayer || [];
function gtag() {
  window.dataLayer.push(arguments);
}
gtag("js", new Date());
gtag("config", "YOUR-MEASUREMENT-ID");
gtag("event", "YOUR-EVENT-NAME", {
  "send_to": "YOUR-MEASUREMENT-ID"
  // ADDITIONAL PARAMETERS THAT YOU MAY WANT TO PASS
});

Make sure you add the MEASUREMENT ID of your GA4 property in the mentioned places. And also, use the event name as per your requirement.

You can find your MEASUREMENT ID by navigating to the Settings -> Data collection -> Data streams

Note that it takes about 20-30 seconds for events to reflect in Google Analytics

PreviousGoogle AnalyticsNextSalesforce

Last updated 10 months ago

Was this helpful?

Refer to this page for default GA events --

🔗
https://developers.google.com/analytics/devguides/collection/gtagjs/events
Measurement ID of a GA4 property