I'm working on the site that sells subscriptions.
On /subscribe page, there's a list of available subscription plans, that I push to Analytics as product impressions on page load using dataLayer syntax. On clicking the plan, its details are shown, so it'd be natural to send "productClick" in click handler. This info is sent to GA, but then product details is shown on the same page, changing the location hash.
GA documentation gives the only example on how to track product details given page view, but we don't actually have one here. Is there a way to manually send product detail?
In addition, there's a user flow which involves showing the same /subscribe page in an iframe. I'd like product impressions to be sent to GA too, but, once again, when I push to parent.dataLayer, the data is not sent to GA.
Also, clicking on plan maps to addToCart event, so I'd like to send it as well, but somehow what goes through is only a "productClick". Is there a way to push both "productClick" and "addToCart" events at the same time?
"Is there a way to manually send product detail?"
You need an interaction hit to send the data with Google Analytics. Plus the data must be available before (or alongside) the GTM event (be it native or a custom event in the datalayer) is fired, since GTM updates its internal data structure from the datalayer variable when an event occurs.
In your case, since the location hash changes you might be able to use GTMs history change event handler (or you push a custom event with your product data) to fire a Google Analytics event that sends your e-commerce data. Conceivably you could event do a pageview with a virtual pagename if the content changes enough to warrant to be counted as a new page.
Related
I have a hybrid app where the store is built on Webview the rest is native mobile. Users access the store via the menu button.
Since the store is web, I set up dataLayer variables where I have user information such as nickname, id, etc and also an ecommerce object where the items in the store are shown. I have also added dataLayer events such as view_item, process_purchase and purchase_completed.
I have integrated GA4 and GTM and I pass all dataLayer variables as event parameters so I can have organized.
The main problem is that, when users pay their order via card, they are taken outside the website to the payment provider solution, and then once the payment is finished, they return to the payment confirmation page where I set up the "purchase_completed" dataLayer event. This appears to break the tracking of the funnel, so sometimes purchase_completed event does not fire, or sometimes it fires but empty (no data on datalayer).
Is there a way I can fix this issue?
To me, your problem sounds rather shop related, than GTM related.
If your DataLayer.push event is malfunctioning (either empty or not firing at all), you need to your code.
GTM does not care for a funnel, if the dataLayer event fires and both trigger as well as tag are setup corretly, the tag is executed.
When using the Google Tag Manager, is it possible to track some things the old way in addition to using the GTM?
For example, I use GTM in order to fire a page view.
However, I want to fire another page view, when a user clicks a button, also known as a virtual page view.
The button in question doesn't have an ID and I don't trust the othet agency, which handles these buttons to consistently keep the same IDs for these elements. So I would rather have them be responsible for these types of page views.
The code for the virtual page view would look something like that:
ga('send', {
hitType: 'pageview',
page: 'button2'
});
Since the tracker is already initialized by GTM, I would only have this code outside GTM.
Would this work if all other google analytics related things run over gtm and where should I put this code in this case? Somewhere after the GTM code on the page I'd imagine?
Google Tag Manager (GTM) by default uses a random name for each tracker, generated for each Universal Analytics tag. There is a possibility to use fixed name for trackers, which is highly discouraged. This means, that you might have difficulties to identify the proper tracker to use, when sending your additional pageview data.
There are however other methods to send virtual pageviews using GTM, where you can benefit from your existing Analytics settings, defined in Google Tag Manager. (Preferably by using Google Analyitcs Settings variable.)
As far as I understand, you have control over the code, to run some JavaScript on the relevant click event.
So instead of directly invoking the ga object, you can send the desired data to GTM, with a call like this:
dataLayer.push({
event : 'virtualPageView',
virtualPagePath : 'button2'
});
Obviously, there are a couple of things you need to set up in GTM, which will be able to act on this event, and send the pageview to Google Analytics.
Create a variable that points to virtualPagePath dataLayer variable, so the newly pushed value could be reused
Create a custom event trigger, that can be used with one or more tags. The event name should match your given event name, virtualPageView in my example.
You need an Universal Analytics tag, which will send the pageview. This tag should be fired by your new custom event trigger, and should have an extra setting compared to your regular pageview tag. Namely, page variable within the Fields to set block should point to the newly created dataLayer variable, that contains your virtual page path.
This way, Google Tag Manager will take care of creating the tracker for you, sending the hit to Google Analytics, and using the virtual page path variable provided by you, instead of the URL in the browser address bar.
I have created a tag which fires when the click url contains certain words. When I view the website in GTM debug mode the tag is getting fired. But the event is not getting captured on Google Analytics Real Time Events.
The following is the screenshot of my tag and trigger.
Will the real time events in Google Analytics not show until I publish the changes in GTM?
What the possible problems you may have(as you are saying your tag is firing and IP was not filtered in GA:
Your tracking ID for GA is incorrect(or you are checking data in the wrong GA property): your tag config looks correct, so data should be sent to GA(as you are saying GTM trigger works fine);
Trigger name is hidden, but looks like trigger type is "Click". Make sense to check if option "Wait for tags" was enabled. If this option is disabled and after click user redirecting on another website page, GTM may not have enough time after click and before redirection to send data to GA. And your tag will fire, but data will not be received to GA.
I had the same problem. It ended up being a double up in the GA id. I had used a constant variable to define the GA property but not removed the ID itself.
I am looking for something that would enable me to trigger an action in another system (a CRM).
For this, ideally, I would like Google Analytics (or Google Tag Manager) to notify the other system the event of shopping cart abandonment.
Assuming I am using customer tracking id, I would like to know a few parameter values.
How can this be implemented? Is this feature provided by GA or GTM?
Thanks
Technically you could do that with GA, if your CRM have support for incoming email as notification option.
Basically you could give an event value of -1 for your abandonment event and set up a Custom alert firing on negative value of your event (for example - set alert for Action "Abandon" and condition - value less than 1). Anyhow, this is just example setup, there are many option.
Set email notification for your alert (don't forget to set it for daily) and you are done.
In my product page detail, i have a crosselling section which loads a product list when user scroll down. I can trigger a custom event when products in this section are loads (like productsDowloaded).
How can i send product impressions with google tag manager ?
Implement the data layer following these specifications to track product impressions. If you are sending the data asynchronously, push an event to the data layer (eg: event: 'crossSellReady') and fire your custom event GA tag with a rule based on event = crossSellReady. In the custom event tag, make sure to enable enhanced eCommerce tracking, and the tag should automatically pick up the product impression data contained in the data layer. Let me know if you encounter any issue.
When the page is first loaded the first batch of cross sell products are pushed to the dataLayer as impressions and a GA pageview is sent. The GA pageview is a simple GA tag that is fired after the page is loaded.
After that, when the cross sell products are loaded asynchronously, i.e. whenever the user scrolls down, only those products are pushed to the dataLayer and a custom dataLayer event is fired in the success handler of the ajax request. For example:
// Inside Ajax success handler...
dataLayer.push({
'event': 'Custom'
'eventCategory': 'ecommerce',
'eventAction': 'ajax-load'
'eventLabel': 'cross sell'
});
You create a separate generic GA tag that sends events and is fired when the Custom event is pushed to the dataLayer. Inside the generic GA event tag you set all the of the following macros which are of type dataLayer variable:
{{event category}} -> eventCategory
{{event action}} -> eventAction
{{event label}} -> eventLabel
You can also add a nonInteraction macro in the generic GA event tag as well. Your use case, in my opinion, is considered a user interaction (user scrolled down) so the nonInteraction macro should not be set.
If you are using product lists, be careful of the positions of the cross sell items. Whenever those products are asynchronously loaded, you should note down their positions so you can track their positions in the product list tab of the GA dashboard correctly.
P.S. The generic GA event tag has multiple benefits, you can find more information about what I'm saying by reading the relevant article in Simo Ahava's blog.