Google Tag Manager integration with SurveySparrow lets you track, analyse and improve the visitor analytics of your survey campaigns with the help of tags and covers a wide range of user interactions such as form submissions, click events, scroll events, page visits, etc. This data can be then pushed to various analytics tools like Google Analytics, Facebook pixel, etc.
Advantages of integrating your Survey with Google Tag Manager
Improve the visitor analytics of your survey campaigns with the help of tags
Gain deep insights on a wide of range user interactions including form submissions, click events, scroll events, and page visits.
Integrating your Survey with Google Tag Manager
Let’s see how it’s done:
1. Login to your SurveySparrow account and choose a survey from the readymade templates or create a new survey and build it with your required questions.
2. Now, navigate to the integrate tab and enable the Google Tag Manager toggle
3. In the dialogue box, enter the Google Tag Manager tracking code of your workspace and click Connect to complete the integration process.
4. To find the GTM Tracking Code, Sign up for a Google Tag Manager account and create a new workspace. The GTM code can be found on the header section of your workspace.
Here’s how you can track the page view when a survey is being viewed.
Navigate to the GTM dashboard and click on Tags> New or click "Add a new tag"
2. In the Tag configuration window, choose Google Analytics: Universal Analytics as the tag type, and Page View as the Track type.
3. Then, in the Google Analytics Settings, enter your Google Analytics tracking code.
4. Now, to create a new trigger, click on Triggering section under the Tag Configuration.
5. Click on the Plus sign at the top right corner and then click again on the triggering section as you can see in the above screenshot.
6. Select Page view from the options and click Save.
7. Now whenever a survey is viewed, GTM pushes a page view to Google Analytics.
Here’s how you can fire an event when DOM is loaded
First, to create an event, go to the GTM dashboard and click on New Tag
Under the Tag Configuration, choose Google Analytics: Universal Analytics as the tag type, and Event as the track type. Then fill in the Category, Action and Label.
Then, go to the Google Analytics settings and fill in your Google Analytics tracking code.
Next, create a trigger by clicking on the Triggering section under the Tag configuration.
Click on the plus sign at the top right corner and then click again on the triggering section. Choose DOM Ready and click on Save
Now, whenever the user visits a survey page and the DOM is ready, this particular event will be fired.
Using GTM debugging tools to see the events pushed to the GTM data layer.
1. Create a GTM workspace, if you haven’t yet.
2. Open your GTM workspace and click on the Preview button on the top right corner
3. In the newly opened tab, enter the survey URL you want to debug and Click on the Start button.
4. Your survey will be opened in a new tab with `?gtm_debug=x` appended to the URL. Further, you will see Debugger connected Dialogue box at the bottom right side of the survey page.
5. As you start answering the survey questions, various events will be added to the Tag Assistant Page. Some of the actions that GTM tracks in default are when a survey is started, answered, skipped, or submitted. These events pushed from the SurveySparrow survey to the GTM data layer.
6. Once you have completed addressing the events, disconnect the debugger.
Embedding Custom HTML using GTM
You can embed custom HTML on the survey page with the help of GTM(Google Tag Manager). To embed a small HTML Script via GTM which will run on the survey Page, follow these steps:
Create a Survey and integrate with the GTM
Now navigate to the GTM dashboard and create a new Tag.
In the Tag Configuration section, Select Custom HTML
4. Then add a custom JS snippet alert message as shown below
alert ("Hello from Google tag Manager")
5. Create a trigger by clicking on the Triggering section under the Tag configuration. Choose the Page View trigger, so whenever the page is viewed for the first time, the above script will run.
6. Name the Tag and save it.
7. To test it, click on the Preview button on the top right corner of the GTM homepage and proceed with debugging.
8. Once you land on your survey page, you will see the alert that was created.
9. To disable the GTM - SurveySparrow Integration, go back to the Integrate tab, and turn off the integration toggle.
Feel free to reach out to us anytime if you're stuck. We're happy to assist you :)