# Get started

The global site tag (gtag.js) is a JavaScript tagging framework and API that allows you to send event data to Google Analytics, Google Ads, and Google Marketing Platform. For general gtag.js [documentation](https://developers.google.com/analytics/devguides/collection/gtagjs), read the gtag.js developer guide.

{% hint style="info" %}
Before starting make sure to know the basic of Google global site tag (gtag.js) already. Important parts of the plugin API have their link to the official documentation to help you out.&#x20;

Whenever you don't understand something and the documentation lacks information, just create an issue on Github.
{% endhint %}

## Install

```
$ npm add vue-gtag
```

## Add plugin to your application

This is the basic installation required to start using the plugin

```javascript
import Vue from "vue";
import App from "./App.vue";
import VueGtag from "vue-gtag";

Vue.use(VueGtag, {
  config: { id: "UA-1234567-1" }
});

new Vue({
  render: h => h(App)
}).$mount("#app");
```

{% hint style="info" %}
This is just an example by using the Google Analytics domain ID as a configuration ID, but it is possible to use things like Google Adwords as well, so make sure to read the gtag documentation if you need more insights about what type of tracking code you need to use
{% endhint %}

After this you will be able to use the `gtag` library inside your components contextually by accessing it like this example

```javascript
export default {
  name: 'MyComponent',

  methods: {
    login () {
      this.$gtag.event('login', { method: 'Google' })
    }
  }
}
```

## Initial config parameters

The config object accepts also a `params` property that will add additional parameters to your initial config call

```javascript
import Vue from "vue";
import App from "./App.vue";
import VueGtag from "vue-gtag";

Vue.use(VueGtag, {
  config: { 
    id: "UA-1234567-1",
    params: {
      send_page_view: false
    }
  }
});

new Vue({
  render: h => h(App)
}).$mount("#app");
```

{% hint style="success" %}
Here is the perfect moment to add the send\_page\_view property to false if you don't want to send the first page hit on load of your application
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://matteo-gabriele.gitbook.io/vue-gtag/master/master.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
