GoodData
Integrations

Integrating Gooddata with Vue.js

Adding Gooddata to your Vue.js project is a simple, straightforward process. Follow the step-by-step instructions below to start tracking your visitors without compromising their privacy.

Step 1: Copy Your Project ID

Before you begin, you need your unique Gooddata Project ID.

  1. Log in to your Gooddata Dashboard.
  2. Select your project from the sidebar.
  3. Click on the Settings gear icon in the bottom left.
  4. Copy the Project ID or the provided tracking snippet block.

Step 2: Add the Script to your HTML Template

In a standard Vue.js project (created with Vue CLI or Vite), there is a main index.html file at the root of your project.

  1. Open the index.html file in your code editor.
  2. Locate the <head> tags.
  3. Paste the tracking script right before the closing </head> tag.
  4. Make sure to replace <YOUR_PROJECT_ID> with the ID from your dashboard.
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Your Vue App</title>
    <!-- Add Gooddata here -->
    <script defer data-project-id="<YOUR_PROJECT_ID>" src="https://gooddata-fyp.onrender.com/sdk/tracker.js"></script>
  </head>
  <body>
    <div id="app"></div>
    <script type="module" src="/src/main.js"></script>
  </body>
</html>

Step 3: Verify the Installation

Once you have added the script and published your changes, it's time to test if Gooddata is receiving data.

  1. Open your live website in a new incognito/private browsing window.
  2. Navigate to a few different pages.
  3. Return to your Gooddata Dashboard and go to the Realtime tab.
  4. You should see "1 Active Visitor" and your recent page views populating instantly.

Troubleshooting: If you don't see any data, make sure you don't have an adblocker enabled that might be blocking the script, and ensure you replaced <YOUR_PROJECT_ID> with your actual ID.