The aim here is to generate an event in Google Analytics each time there is a conversion resulting from a Qualifio campaign (such as the submission of a form), all via Google Tag Manager. The objective is to measure the conversions generated by Qualifio campaigns directly in Google Analytics and to include those in your goals, reports etc.
The Google Tag Manager tag needs to be present in the management of the website to which the Qualifio campaign is linked. Here’s how:
The standard Google Tag Manager tag is Tracking = Page views. If this is present in Google Tag Manager, a page view will be counted each time a Qualifio iframe is updated, whether the publication channel is Facebook, iframe, mini-site etc.
The aim here is to create a Conversion in Google Analytics whenever a participant submits their form and creates or updates a profile. This logic is applicable to any other type of conversion.
Need an example?
In this example, a conversion corresponds to a form submitted. The conversion therefore occurs when a participant clicks on the “Send” button below a form. It’s the button that will be used as conversion trigger.
In Google Tag Manager:
Creating a tag and a variable page title
- Creating a new Google Analytics-type tag called “Qualifio Conversion” (for example)
- Tracking type = Event
- Category & Action are to be defined in accordance with an internal nomenclature. In this example:
a. Category: Conversion_Qualifio
b. Action: Submit
c. Label: see below
This conversion tracking will be applied automatically to all campaigns linked with a website in Qualifio. It is important therefore to distinguish the different Qualifio campaigns in Google Analytics.
The event’s label will be used for this purpose and will vary from one campaign to another.
In any Qualifio campaign, the source code for each page contains <h1 class=”campaign_title”>QPA: Test GTM</h1>— i.e. the title of the campaign. It is the value that needs to be attributed to the label in order to have the campaign’s title visible in Google Analytics for each conversion.
In order to do that, a variable needs to be created in Google Tag Manager.
- To create this variable, simply click on the + next to the “label” field
- Copy and paste the following code:
var title = document.getElementsByClassName(“campaign_title”).textContent;
4. Name the variable (PageTitle)
5. Save the variable
Result: a Conversion Tag is created. When triggered, it will create a conversion-type event in Google Analytics with the name of the Qualifio campaign.
Triggering the tag
This tag then needs to be triggered at the right moment, i.e. when the web user submits their form. This ‘Submit’ button has a specific identifier in the page’s code. This identifier is the same for any Qualifio campaign: register. It’s this register ID that we’re going to use.
- Click on the variable;
- Activate the “click” ID variable;
- Click on “Trigger”;
- Add a new trigger and give it a name;
- Event type must be “click”
- Target is “all elements”
- Trigger is “certain clicks”
- Select “click ID is equal to register”
- Create the trigger.
The tag now needs to be linked to the trigger:
- Click on the tag;
- Click on the conversion tag;
- Trigger: click on “click” and select the new trigger;
In Google Analytics, this new event simply needs to be linked to a Goal. Whichever user creates a Qualifio campaign linked to this site, once a register-type button exists – a conversion will be reported in Google Analytics each time it’s clicked on.