Google Tag Manager is a tag management system (TMS) that allows you to quickly and easily update measurement codes and related code fragments collectively known as tags on your website.To save time and confusion, review the Google documentation Considerations before you install and Setup and install Tag Manager to evaluate if this is the correct option for your Drip account.
Deploy Drip’s JavaScript Snippet With GTM
If you haven’t yet placed your Drip JavaScript snippet on your site, you can use Google Tag Manager for this. Grab your Drip tracking snippet from your Drip account (find this under Settings > Account > Site Setup).
- In Google Tag Manager, click New Tag.
- Add a name to your tag (“Drip JavaScript” is a good one).
- Click the Tag Configuration module and select Custom HTML.
- Copy and paste your JavaScript tracking snippet located in your Drip account (Settings > Account > Site Setup).
- Click on the Triggering module.
- Select All Pages and click the blue Save button located in the upper right-hand corner of the tag configuration.
- Publish your tag.
Now that your tag is published, make sure it is active on your website. Navigate back to your Google Tag Manager Workspace and select Preview and Debug.
When you reload your web page, Look for the GTM Debug Console. This console will appear on any web page that you have installed/published your Google Tag Manager snippet.
In order to test properly, you’ll need to submit an email address to Drip through an opt-in widget. This way, Drip will track your test actions and associate them with your test person record.
Track Events
You can use Google Tag Manager (GTM) to send events to Drip. Sending events to Drip will allow you to fire your automation sequences using Workflows or Rules. To do this, we will use Drip’s JavaScript API, calling the “track” method.
Here’s the API call:
<script>_dcq.push([“track”, “My Event”, {myProp: "My property"}]);</script>
- Add a new GTM tag using the API snippet.
- Click “New Tag” in the GTM interface under Workspace > New Tag to configure the tag and select Custom HTML as the tag type.
- Give the tag a descriptive name. For this example, we’ll name the tag My Event, but this name is arbitrary and you should choose a more descriptive name for your event. Then, copy and paste the JavaScript snippet from above and change the name of the event and add any properties you’d like. It’s recommended to name the event the same name as the tag to keep things concise, then click Save.
Once you have the snippet to the tag, create the trigger event to fire the tag and send the event over to Drip.
- Click on the Triggering module of the tag setup
- Click the + icon to add a new trigger
For this example, we will set up a click event to fire off our tag.
- Select All Elements under the Click heading for this trigger.
- Trigger event, we will select All Clicks to learn how this works.
In the end, you may only want your tag to fire when a user clicks something specific on your website, such as a call to action button, for example. If that’s the case, you would select Some Clicks and use the built-in options GTM gives you to set this up.
Preview the Tag
- Click the Preview button in the upper right-hand corner of Google Tag Manager.
- You should then get this success message.
- Go to your website and refresh the page. If the GTM preview mode is not already open, you can click the launch the Debug console, located in the lower right-hand corner of the browser window.
Because our tag is configured to fire on All Clicks, this means you can click anywhere on your site to fire the tag. Once you click anywhere on your site, you will see an event called gtm.click under the summary sidebar in the GTM preview console. Select that click event and you should see your event under the Tags Fired On This Event heading. Once that is working, all we have to do now is submit our changes so that this will still work once we exit preview mode.
Submit your GTM changes
It’s important that you remember to submit your workspace changes in order for them to take effect once preview mode is turned off. To do this,
- Click Submit in the upper right-hand of the GTM view
- Add a message with your change
Test the Event
In order to test sending events to Drip, you’ll need to submit an email address to Drip through an opt-in widget. This way, Drip will track your events and associate them with your test person record.
Once you have submitted a form with your email address, go back to your website and run your click event again to see it register on the person’s timeline.