Using Google Tag Manager to Setup Conversion Tracking

Google Tag Manager is a tag management system that allows you to update tags and code snippets on your website or mobile app, such as those intended for traffic analysis or marketing optimization.

You can use Google Tag Manager to deploy the Oktopost tracking code on your website, without having to involve development, in a few simple steps.

Getting Started

If you already have a Google Tag Manager account you can go ahead and skip this step, otherwise lets begin by making sure that GTM is properly set up.

  1. Go to Google Tag Manager and create an account
  2. Create a container for your site
  3. Add the container snippet to your site

Once the account is set up the next step is to create a tag for the Oktopost tracking code.

Creating a Tag for Oktopost

A tag is a snippet of code that sends information to a third party, in this case Oktopost. By using GTM you can specify the tags that you want to fire and when do you want them to fire using the user interface.

Step 1: Inside of your site's container go to the Tags tab.


Step 2: Click on New to add a new tag.


Step 3: In the pop out window name your tag.

Step 4: Click on the Tag Configuration box and in the search bar choose Oktopost Tracking Code.


Step 5: Copy and paste your Account ID from your Oktopost Profile -> API  to the text box that appears. 

Step 6: In order to make sure that the code is available on all pages click on the Triggering box and choose Fire on: All Pages.


Step 7: Name the tag in the top left and click Save.

Step 8: Click Publish to implement the updates.

That's it! You can now go ahead and set up the conversion types in Oktopost according to your websites' definition of conversions. If your websites' conversions are triggered using JavaScript events, you will need to use Custom Events as described below.

Custom Events

Custom events allow you to trigger conversions in cases where your forms are submitted using JavaScript without redirecting the user to a destination page. To set up custom events you will need to:

  1. Create a trigger that fires based on a custom event
  2. Create a tag with the Oktopost conversion code that fires based on the trigger you've created
  3. Add the custom event to your JavaScript code whenever a form is submitted

Creating the trigger

A trigger is a condition that evaluates to either true or false. It is composed of one event and one or more filter (except in the case of a custom event which doesn't require a filter.) In GTM you define triggers to specify when tags should or shouldn't execute.

Step 1: Inside of your site's container go to the triggers tab.


Step 2: Click on New to add a new trigger.


Step 3: Name your trigger.

Step 4: Click on the Trigger Configuration box and then in the drop down menu select Custom Event.


Step 5: In Event name write the name of the event you want to use, e.g. formSubmission.


Step 6: Create Trigger.

Next you need to set up the tag.

Creating the tag

Step 1: Inside of your site's container go to the tags tab.

Step 2: Click on New to add a new tag.

Step 3: Name your tag.

Step 4: Click Search, then find and select Oktopost Tracking Code tag.

Step 5: Click Track Type and select Conversion

Step 6: Under Conversion Type, enter the Conversion Tag you would like to appear in Oktopost for your form(s) ex: Contact_Form_Submission

Step 7: Next click on the Triggering box and in the list select the trigger that you have created previously.

Step 8: Click Save.

Step 9: Click Publish to update all changes.

Add the custom event code to your website

Add the snippet below to the JavaScript code used to submit the form on your website. If you're unsure about how or where to place it, you should probably consult with your webmaster or contact us.


A data layer is an object that contains all of the information that you want to pass to GTM. In this case you want to add (push) an object type event the trigger will respond to. "formSubmission" can be anything, as long as you use the same event name from Step 5 in the "Creating the Trigger" section.

Feedback and Knowledge Base