Track VirtualPageiew Datalayer with GTM - google-analytics

This is my very first post on stackoverflow ever. I'm most likely doing something wrong....
I'm setting up some gtm on my site and I have a checkout page that doesn't change urls, so there is virtual page views that populate the datalayer at certain steps. I need some help how to track these events in gtm and how I can get them in to GA as page views.
I've tried to look for exact solutions but I haven't found anything that has helped me, so even linking to an article you think might help me would be awesome.
The datalayer looks like this and gets pushed at certain steps it would be /checkout 1, /checkout 2, /payment method, and finally /purchase.
Structured like this:
{
event: 'VirtualPageview',
page: '/Test/test',
title 'test | test',
gtm.uniqueEventId:25
}
Edit: I know how to set up an event to the virtualpageview, but not sure how to configure it to pas the information forward to google analytics, my goal is to make a funnel.

Just to make sure I'm answering the right thing: It sounds like you already know how to trigger an event during the checkout process, but you're not sure how to get that data into Google Analytics itself.
Assuming that what you want to see in Google Analytics is a new pageview for each step in the checkout process, you need to set the "page" field in the virtual pageview tag so that whenever it fires, it records a pageview.
In the tag, under "More Settings" -> "Fields to set", you can add "Field name": page and then set "Value" to whatever dataLayer variable stores /checkout 1, /checkout 2.

Related

Track behavioral flow from google tag manager event

I want to see which pages a visitor went through, when filling in a contact form. To track the submitting of the form, I setup google tag manager with google analytics.
So now when submitted I see an event "FormSubmitted" in Analytics.
Only now I can't get to figure out, how I can check the behavior flow of only the user which submitted the form.
Is anyone known with this, and knows how to filter that specific usertype out? Tried some filters in the behavior flow section, but couldn't get the right one.
Hope to get a solution here!
Only now I can't get to figure out, how I can check the behavior flow of only the user which submitted the form.
Create a segment with conditions for example "Sessions includes event category = ...".
And apply it on report "Behavior Flow".
Ussually to track steps of form filling it's better to set it before. You need to set sending virtual pages in GTM for each step you want and then create goal in GA type Destination and add steps there. After successful setup you'll see funnel in report 'Funnel Visualization'.

Google Tag Manager trigger on infinite scroll websites

I have a wordpress website that autoscrolls to next blog posts upon scrolling down infinitely and now looking for a way to count the next blog post load to register as a new pageview in google analytics which is setup in google tag manager
I stumbledupon this url http://www.howtofindit.in/how-to-call-tag-manager-code-in-infinite-scroll-website-pages/ BUT the article is poorly written and lack a proper step by step approach to follow without any confusion
Anyone know of a good step by step approach to follow to implement this?
so i can start tracking all blog page loads as pageviews in my google analytics
Just wanted to add that when the next blog post loads on the website i want to track, the page url changes to show the new blog post
so maybe that me be a good info to add here
Thanks
This article seems a bit outdated. While the suggested approach will still be working you should be able to solve this with the (relatively new) visibility trigger.
So you'd go to triggers, new, select "visibility", and as a selector you enter an element that indicates a new article - say if every blog post starts with a second level heading then you enter "h2" in the box for the selector. You need to set this to "fire every time", and "observe DOM changes" (if your posts are dynamically loaded, which they probably are).
Set up a Universal Analytics tag of the pageview type and connect it to the trigger. In "Advanced/Set Fields" you need to overwrite the "page" field (else you will get the same Url for each of your virtual pageviews). The properties of the last element that fired the visibility trigger will show up in the built-in "Click" variables (don't be bothered by the name, that's for historic reasons), so you could access the headline text in the "Click Text" variable (probably you want to format it to a more url-like format).
Save, publish, and you should be good to go.

Google Tag Manager. Tracking link click through a funnel

I had a question about Google Tag Manager. (I also felt bad for having the IT guy fix my mistakes on my simple click tag)
I wanted to track when a user enters a specific url when they click a link button on the homepage.
This is what it looks like
Image
This is my idea on what the Tag and Trigger should look like
Image
But I'm worried about having the trigger be fired when there is another page in the funnel
Also if the only way to do this is in the goal feature of GA that is good to know also. (I currently don't have the permissions here)
Thanks for responses
While it is difficult to achieve exactly what you're describing (it would involve storing data in cookies and then using these cookies to conditionally fire tags), there is a better way to achieve what I assume is your ultimate objective: an analysis of the shopping funnel.
Specifically, the Google Analytics enhanced ecommerce module has a dedicated report (the Conversions > Ecommerce > Shopping Behavior report) that shows you exactly this. It shows you the number of sessions for each stage of your shopping experience (product view -> add to cart -> checkout -> purchase) along with drop-off rates and volumes between each of these steps.
It is a little bit more involved to implement enhanced ecommerce but the final result is definitely worth it for an ecommerce business. Instructions for implementation of enhanced ecommerce (using Google Tag Manager) can be found here.
GTM is hit based without any notion of persistence. So by default this will not work.
You would need a custom HTML tag with a javascript function that sets a cookie, or writes a value to localstorage, when the button is clicked.
Then on your destination page you can check if the cookie exists and fire the tag accordingly.
I don't think the goal feature in GA can do that, either. A goal is registered when you hit a destination URL or event, you cannot specify conditions other than the destination.

google analytics & google tag manager : Where to read the data

I had to integrate the GTM and track few data into a webpage and im facing some comprehsion issues. I dont think it's code wise, but i don't get where i'm supposed to see the data that im tracking.
i've successfully added the GTM code into my application and defined some data to be sent inside the dataLayer variable, after that i can go to the GTM admin panel and choose to Preview and Debug, so i can see the data i'm trying to track and everything seems allright. Therefore, i don't know what happens to them next. I don't know where i can see the data that i track, where they are stored. I've linked my GTM account to my GA account so i can see the traffic and other datas, but not the ones i've put inside my dataLayer object.
Anyone know what are the next steps ?
Here's some screenshots of my tag
Thanks
I think Simo Ohava - the GTM "god" - is explaining it quite well:
Datalayer Basics:
https://www.simoahava.com/analytics/data-layer/
Google Tag Manager & Datalayer:
https://www.simoahava.com/analytics/google-tag-manager-data-model/
As far as I understand you, all your questions (including basics and how to access via tag manager - and more) are pretty nice answered/explained there.
I've linked my GTM account to my GA account
What do you mean by this? Where did you "link" the data? GTM tracks data via the tags you define to fire for various interactions on the pages, including pageviews, events, and transactions (all known as "hits"). Each tag that fires in GTM has an associated Universal Analytics property ID that comes from your Google Analytics account. You must include this ID in all your tags. This is where you tell GTM tags to send your data and this is where in GA you will find the reports on your data.
Simply pushing data to the dataLayer does nothing unless
you're also pushing events to it and using those events to trigger tags to fire
You've defined GTM variables to grab the data being pushed in
Your tags are configure to pull that data into your reports
EDIT
To pull data into GTM from the dataLayer, you need to do the following:
Make sure your data is pushed in the following format:
datalayer.push({
'event': 'your event',
'page': 'custom/path/path',
'otherData': 'custom dimension1',
'otherData2': 'custom metric1'
})
Create a Data Layer variable, whose name can be anything, and whose value is the name of the dataLayer key.
Include the Data Layer variable's name in whatever tag you need the data to apply to. For example, if it's a custom dimension you need to associate to your pageview, then go into the Advanced Configuration of the tag and add the data into the Custom Dimension section (remember to configure your CD in GA, and to include the index). You can be associating any kind of data to the specific tag (eg. page path, page title, page name).
Test and then publish your tag!

Contact Form 7 Conversion Goals Not Tracking

I am using Universal Analytics and have added the following code under the "Additional Settings" tab as suggested by dozens of articles including the one suggested by Contact Form 7's website:
on_sent_ok: "ga('send', 'event', 'Contact Form', 'submit', 'success');"
My Category, Action, and Labels all match set up in Goals. I have been testing this for hours and using various other methods on a different website but still no joy. I am not using any SEO or Yoast Plugins, and I have the Universal Tracking JS code installed.
Yet it's still not tracking. I can see it under Real Time Conversions, but it doesn't appear in Real Time Events nor Conversion Goals. What the heck could I be doing wrong?
After trying every code on the internets, I figured out how to simply set it up using Tag Manager! Obviously you have to have a GTM Account and paste the Tag Code on your website. Here's how to set it up:
Set up a New Trigger called "Form Trigger"
Choose "Custom Event"
Fire On, copy and paste this: gtm.formSubmit
Create Trigger
THEN ---
Set up a New Tag called "Form Submission"
Choose Product: Google Analytics
Choose a Tag Type: Universal Analytics
Enter Analytics Tracking ID
Track Type: Event
Category: Contact Form (or whatever, this will match the category name you set up in Goals in Analytics)
Action: Submit (or whatever, this will match the action you set up in Goals in Analytics)
You can add a Label and Value if you want, just make sure they match when setting up goals in Analytics. I just left them blank in both cases.
Fire On: click "More" and select the "Form Trigger" trigger you previously created.
Save Tag
Then just set up your Goals in your Analytics and test your form. In Reporting, I clicked on Real Time >> Events, filled out the form and BAM! I saw it right away and it recorded in Conversions instantly!
This was THEE only way I could get it to work. Works with sites with or without Yoast or whatever other SEO plugins. I hope someone finds this helpful, I tried EVERYTHING and this was the only way I could get it to work.
Cheers!

Resources