# Work in Progress: How to send data to Google Tag

{% embed url="<https://firebasestorage.googleapis.com/v0/b/savvy-flow-uploads/o/ZH5RO6gKEiwXw7GF3AD6%2FSavvy_(3)_9372531467607306.mp4?alt=media&token=e0755692-ae33-4609-b91c-8245b832f456>" %}

* Create a new custom Data Output and select Manual Trigger Only
* For the first Google Tag event that is triggered on the flow, the following code should be added:

```jsx
function output(userData, context) {
   window.gtag = function(...args) { dataLayer.push(args); }
  return dataLayer.push({ event: 'eventName' }) //replace with the right event name
}
```

* For the rest of the Google Tag events on the flow, follow the structure below:

```jsx
function output(userData, context) {
	//replace eventName with the right event name, add all the properties you need to the same object, an example below
  return dataLayer.push({ event: 'eventName', email: userData.email, questionNumber: `Question 1` })
}
```

* Trigger the data outputs on page complete or page load on the pages where they are needed


---

# 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://docs.trysavvy.com/other-useful-docs/work-in-progress/pending/work-in-progress-how-to-send-data-to-google-tag.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.
