Track external search form in Google Analytics/GTM - google-analytics

We have a search box on our website that searches a product we subscribe to. It's hosted on the third party's server, not on our domain.
Since it's just embedded on our site, I can't use Google Analtyics' built in configuration for tracking site search.
Is there another way I can track the terms used to search in the form, using either Google Analytics/Tag Manager?

yes, you can use GTM if the search query is entered on your site. Let's say, using a trigger on the search CTA click, you can then use a custom JS variable where you get the value of the search field using JS, use that variable in a GA event tag and there you have your value logged in GA.

Related

A Google Form creates an Event in Google Calendar (without using responses)

This is more of a simple yes or no question with the hope that someone could point me in the right direction.
My company has Google Calendar and Google Forms. What we want to do is create a Registration Form using Google Forms, once the Registration Form is created then it will automatically create an event within our Google Calendar with the Registration Form Link.
We do not want to use the responses to create an event, we want to use the form to create the event. The responses are set up within the form to be emailed to the a specific person where they can tally and confirm all the registries.
Our company also has a wordpress site, so maybe there is a plugin for wordpress that creates the form and automatically creates an event on our Google Calendar.
Is this possible?
From the Google Form editor you could create a bounded script project and add to it an script that creates a Google Calendar event, so yes, it's possible.

Is there a way map/set utm parameters in gtm?

I currently have a bunch of traffic going to my website with a query string like so: www.mywebsite.com/?source=facebook
I've installed GTM on my website and also from GTM fire a Google Analytics Page View etc. What i'm wondering is through GTM, is there a way to grab the source (facebook) from the url and set utm_source=facebook when firing the pageview tag.
Or is my only option to change all the links going to my site to be:
www.mywebsite.com/?utm_source=facebook instead?
Thank you everyone for your expert advice. Really Appreciate it.
You can fetch the parameters via an url type variable, and then use the "set fields" option in your GA tag to populate the "campaignSource" and "campaignMedium" fields. If the parameters are not present the url query variables default to "undefined", and undefined fields are not sent, so you do not need to check if values are present.

Preventing trackPageView call in GA from GTM

We have many clients that are using Google Analytics (GA) via Google Tag Manager (GTM) on their website. My company provides AJAX pages for our client's site where we track user interaction using custom trackPageView calls. For regular GA code this was not a problem - we would set up the GA code in the static header, omitting the trackpageview call
<script type="text/javascript">
var _gaq=_gaq||[];
_gaq.push(['_setAccount','UA-5620270-1']);
</script>
and then whenever the user interacts with something on the AJAX portion of the page (initial page load, clicking options etc) we call trackPageView with a virtual URL
_gaq.push(['_trackPageview','/someurl?param1=abc&param2=def']);
The problem we have with GTM is that we are getting double tracking - the initial trackPageView call coming from GTM, then the virtual URL call on the AJAX portion of the page - on initial page loads. We can't disable the virtual URL on initial page loads on our end. We need to be able to get GTM to send through all the GA code (setAccount, domain name etc) except for the trackPageView bit. Is there any way to do this in GTM?
Not the most elegant, but easy to implement solutions:
pass a virtual url to the page call in GTM and set up a filter in your data views that excludes this url from the reports or
place your GA code in a custom tag instead of using a code template and omit the trackPageView-Call
I am not sure if this option is possible given your description, but virtual pageviews are not the best solution -- the total pageviews and related metrics are inflated and you cannot tell which segments are really engaging with the site more and which less.
Event tracking would be a smart way to do this. And with new GTM this is not difficult to setup at all. You could create all-new tracking (to the same account) and attach a string to your new tags, and then simply add include-only filter that will not allow any other requests.

Custom Google Campaign Tracking

I'm building out a site that has predefined affiliate ids that are driving traffic to our sites. We currently use this paramater to track our seo work internally. Now we want to do the same through Google's Campaign Tracking at the Session level. The problem is we don't want to change our url, is it possible to manually build the Google campaign tracking pixel url? I'd like to take our affiliate ids and convert them over to a tracking campaign pixel for Google.
Seems like Google built this so all the tracking data must be in the url, is there a way to do the same tracking w/o the google data in the url?
Instead of:
http://www.mypage.com/?utm_source=google&utm_medium=cost-per-click
I want to use(javascript will do the rest):
http://www.mypage.com/?affid=123456
Turns out here is exactly what I was looking for:
https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiCampaignTracking
This is essentially doing everything the Google Campaign Tracking does but you have full control over what parameters are passed in the tracking pixel. I don't have to change or mess with the url, our in house tracking will work as it should, and now the google tracking pixel will be built as I specified.
You can programmatically set up a virtual pageview based on the affiliate id.
In an if statement, determine if you have an affiliate id. If you do, write some logic to build out the proper campaign, medium and source, then concatenate it to your URL. Pass that to GA via the trackPageview method instead of letting it do it's own thing.
Keep in mind that passing a virtual URL does replace it's default behavior, so you won't have the affid parameter in your content reports unless you build it in to the virtual pageview.

managing redirection with google analytics

I have a site that contains the file
redirect.php?id=123
It redirects folks to another site using an id it pulls from the database.
I'd like to track the page on Google Analytics, see where users are coming from, and what popular sites they're going to.. etc.
I currently set up the page so that it pulls (with PHP) the link from the database, and outputs the ga.js stuff and a javascript redirect.
The issue is that I'm getting the data on my analytics dashboard as if every id is a different page..
What is a better way to do this?
If you want to check for pages of the type redirect.php?id=x then the page Carlos links to is how you would do it.
You would want to exclude the id parameter from your search. Then Analytics would combine all the redirect.php?id=1 redirect.php?id=2 redirect.php?id=3 pages as just a single page named redirect.php
How do I exclude query parameters from my reports?

Resources