# Google GTM Guide

To implement [GTM](https://marketingplatform.google.com/about/tag-manager/), you need to do 2 main steps:

### I. Add Spindl SDK as a Tag

1. In Your Tags Section, click `New`
2. In **Tag Configuration**, select `Custom Html`

<figure><img src="https://1560216118-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXCbRJugC9obtJ12iHKUB%2Fuploads%2FyuM18YRwXnFeFQLCu6WI%2FScreenshot%202024-08-15%20at%2010.33.18%E2%80%AFa.m..png?alt=media&#x26;token=5f321322-833f-4dec-afe8-2b010f8a5e1c" alt=""><figcaption></figcaption></figure>

3. Paste in Spindl Script below with the unique SDK Key that we provide to you. This code does 3 things:

* Installs spindl script
* Enables auto Page View events
* Enables auto Wallet Connect events
  * (we can only collect Wallet Connect events automatically for Metamask chrome extension. If you want to also capture Coinbase, OKX and other types wallets, then contact us & we will help set you up)

```html
<script src="https://cdn.spindl.xyz/attribution-1-8-1.js"></script>

<script>
 window.spindl.configure({
   sdkKey: "<Your SDK Key Here>" // use your personal SDK key here
  });
  
  window.spindl.enableAutoPageViews();
  window.spindl.enableAutoWalletConnects();
  
</script>
```

4. For **Triggering**, choose `Initialization - All Pages`

<figure><img src="https://1560216118-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXCbRJugC9obtJ12iHKUB%2Fuploads%2FT5ue7tImnA7V9doe3xRt%2FScreenshot%202024-08-19%20at%202.26.10%E2%80%AFp.m..png?alt=media&#x26;token=fa07775d-6583-4574-adf4-aec641e238d2" alt=""><figcaption></figcaption></figure>

4. Click `Save` and don't forget to `Submit` the changes at the top right once you're ready.

Once submitted, you should shortly see `Page View` and `Wallet Connect` events in your Spindl Dashboard under the `Data` tab

<figure><img src="https://1560216118-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXCbRJugC9obtJ12iHKUB%2Fuploads%2FyQClnQ8tiUzAv2YsnbN4%2FScreenshot%202024-08-15%20at%2010.44.16%E2%80%AFa.m..png?alt=media&#x26;token=3173c778-cceb-4e5d-b086-ab033017f0e8" alt=""><figcaption></figcaption></figure>

### II. Track Custom Events

Now that the Spindl SDK has been instantiated and some events are flowing, you may want to track important custom events. These could be anything from button clicks to form submissions, navigation to specific areas, purchases, etc. To set this up, we need to follow 3 steps:

1. **Configure your Triggers:**&#x20;

* There are many ways to configure these that are outside the scope of Spindl. Feel free to watch some tutorials on YouTube to familiarize yourself with options if you're new to this

2. **Add Spindl Tag Template:**

* Go to `Templates` section and in `Tag Templates` section click on `Search Gallery`&#x20;
  * Find & Select `Spindl Tag Template`

<figure><img src="https://1560216118-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXCbRJugC9obtJ12iHKUB%2Fuploads%2FleV9Nyhwrjz1FAZCRCoC%2FScreenshot%202024-09-23%20at%2012.02.49%E2%80%AFp.m..png?alt=media&#x26;token=db0ee81f-4f1b-4fad-a1d9-3f30d09e152d" alt="" width="375"><figcaption></figcaption></figure>

<figure><img src="https://1560216118-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXCbRJugC9obtJ12iHKUB%2Fuploads%2F8g2RokpfwGn96P52PecL%2FScreenshot%202024-09-23%20at%2012.09.19%E2%80%AFp.m..png?alt=media&#x26;token=95797780-9143-4ca8-8406-04df6070e661" alt="" width="375"><figcaption></figcaption></figure>

3. **Configure Your Triggers & Tags:**

* Go to the Tags Section and click on `New` to create a new Tag
* In `Tag Configuration` select `Spindl Tag Template` that you added in step 2.&#x20;
* Add the Event Name that you want to show up in the attribution
  * Event Type is by default  `Custom`. We may add more options here in the future

<figure><img src="https://1560216118-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXCbRJugC9obtJ12iHKUB%2Fuploads%2FEiWMA3K8zAEKqAXdXT6F%2FScreenshot%202024-08-15%20at%2012.21.34%E2%80%AFp.m..png?alt=media&#x26;token=13436e18-61a6-45ea-bb5c-92598f52ddbd" alt=""><figcaption></figcaption></figure>

* In `Triggering`, pick the triggers that you configured in Step 1 and click `Save`. You can `Preview` the changes (button in top right) before you submit the Workspace Changes.
  * After 10-20 seconds you should start seeing `Custom` events in the Spindl Data tab

    <figure><img src="https://1560216118-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXCbRJugC9obtJ12iHKUB%2Fuploads%2FhdMpXI2FghWq5w6Q2Y2X%2FScreenshot%202024-08-15%20at%2011.18.25%E2%80%AFa.m..png?alt=media&#x26;token=9becded5-e5a7-4f5c-a3c7-df8df4685635" alt=""><figcaption></figcaption></figure>
