# Custom code in google tag Manager

**URL:** <https://community.hubspot.com/t/custom-code-in-google-tag-manager/87824>\
**Category:** APIs & Integrations\
**Tags:** events, object\
**Created:** [August 18, 2023, 3:53pm UTC](https://community.hubspot.com/t/custom-code-in-google-tag-manager/87824 "2023-08-18T15:53:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![NCharles0](https://avatars.discourse-cdn.com/v4/letter/n/b5ac83/32.png) [@NCharles0](https://community.hubspot.com/u/NCharles0)\
**Post date:** [August 18, 2023, 3:53pm UTC](https://community.hubspot.com/t/custom-code-in-google-tag-manager/87824/1 "2023-08-18T15:53:39Z")

</div>

Hey I am trying to get google tag manager to see hubspot event. Eg. If a deal amount becomes greater than 0 how can I create an api call to view this data? Is it possible I have provided a sample code I have. Any help is apprecitated

```lia-code-sample
<script>
 var apiKey = {{HubSpot API Key Variable}};
 fetch('https://api.hubapi.com/crm/v3/objects/deals/?archived=false', {
 method: 'GET',
 headers: {
 Authorization: 'Bearer ' + apiKey,
 }
 })
 .then(response => response.json())
 .then(data => {
 })
 .catch(error => console.error('Error:', error));
</script>

```

---

<div class="post-metadata">

**Author:** ![Mike\_Eastwood](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/mike_eastwood/32/70075_2.png) [@Mike\_Eastwood](https://community.hubspot.com/u/Mike_Eastwood)\
**Post date:** [August 18, 2023, 4:56pm UTC](https://community.hubspot.com/t/custom-code-in-google-tag-manager/87824/2 "2023-08-18T16:56:14Z")

</div>

Hi @NCharles0

**WARNING:** Any code you add to Google Tag Manager is publicly visible so you would be sharing your key with the world… essentially giving anyone access to your portal data!

Other than that - I don’t think I understand what you’re trying to achieve, can you please elaborate.

Thanks

Mike

Here to learn more about HubSpot and share my HubSpot Knowledge. I’m the founder of [Webalite](https://www.webalite.com?utm_campaign=community-forum&utm_source=community&utm_content=signature) a HubSpot Partner Agency based in Wellington, New Zealand and the founder of **Portal-iQ** the world’s first automated [HubSpot Portal Audit](https://portal-iq.com?utm_campaign=community-forum&utm_source=community-forum&utm_content=signature) that helps you work smarter with HubSpot.

---

<div class="post-metadata">

**Author:** ![NCharles0](https://avatars.discourse-cdn.com/v4/letter/n/b5ac83/32.png) [@NCharles0](https://community.hubspot.com/u/NCharles0)\
**Post date:** [August 18, 2023, 5:01pm UTC](https://community.hubspot.com/t/custom-code-in-google-tag-manager/87824/3 "2023-08-18T17:01:59Z")

</div>

Thank you for that update.

I am trying to have google tag manager see any time a deal is updated with certain properties. Example if the deal amount is greater than 0 it triggers the tag manager or if the deal stage is updated. Hopefully this clears things up a little
