Google Analytics goal tracking with url parameter - google-analytics

I'm trying to setup conversion tracking on a site, where a form can be filled on different pages. The only thing that the confirmation url after filling a form is ?surveySucces, so pages where a form is filled could be:
domain.com/landingpage?surveySuccess
or
domain.com/landingpage/subpage?surverySuccess
I just want to setup up one goal, so I can track all the forms that are filled. I've tried with RegEx, but with no luck.
Any ideas?

Try these goal settings:
Goal setup: Custom
Type: Destination
Match type: Regular expression
Value: \?surveySuccess
Case sensitive: unchecked

Related

How to get the User Agent of a user triggering a GTM event?

I have a Data Layer event push in JS and was wondering if it is also possible to learn the User-Agent of the users triggering the event.
You need to create variable which will return user agent
1) Go to Variables -> New
2) Name: User Agent
3) Type: Custom JavaScript
4) Code:
function () {return navigator.userAgent;}
Then you can use this variable in your tags like that {{User Agent}}
Even more simply, can't you use a "JavaScript Variable" (instead of a "Custom JavaScript" and then just set navigator.userAgent?
Google analytics custom dimension field can be maximum 150 characters and user agent data (when encoded) usually exceed the limit. You need to find a way to shorten the user agent information within a custom js script before sending to GA. You may crop the first 150 character of the user agent information or remove the unnecessary sections or remove the blank characters.

How do I pass a parameter from my site into google analytics?

Let's say I have a site and the user comes into it with a parameter:
http://example.com&url=blahblahblah
How do I go about passing along the url value from the parameter into Google Analytics?
1) User comes to the page with a url in the params
2) User clicks a download link with a ga tracking code attached to it which was generated from ga account like this:
http://example.com/download/param1=dkljdf&_ga=1.149898996.39207121.1424368466
You have to create a custom Dimension and a metric for that.
About custom Dimensions and metrics:
https://developers.google.com/analytics/devguides/platform/customdimsmets
After you have created a Dimension, you can add metrics to it by view, in example.
Follow the steps here for Universal Analytics:
https://developers.google.com/analytics/devguides/collection/analyticsjs/custom-dims-mets
Note that due to not have 10 point of reputation, I wrote the a "_" in http like "ht_tp"
BUT:
I think what you want to know is the number os visitors that clicks a download link in your site that comes from, lets say "blahblahblah" as web origin or other methods.
For that, you have the param utm_source that you can receive directly in the url.
So instead of ht_tp://example.com&url=origin you should receive ht_tp://example.com&utm_source=origin
In this way, you have no care about it. Analytics is going to take care for you so you can get a report of clicks by source.
Or, just use the referer in case all the incoming visitors are from webs:
ga('set', 'referrer', 'ht_tp://example.com');
And a final option, to use Events:
_gaq.push(['_trackEvent', 'ReferencedVisitors', jsVarWhereYouHaveTheOrigin]);

Tracking a conversion funnel that changes subdomains

I am trying to set up Google Analytics (Universal/analytics.js) to track a user account set-up funnel on a single website with many subdomains. On each subdomain, a user can express interest in creating an account, and then create the account. Once the account is created, they leave the subdomain and arrive on the main domain.
For the subdomain foo, the flow is like this:
foo.maindomain.com - register interest
foo.maindomain.com/inv/acc0unTt0k3n - enter account set-up details
maindomain.com/extra_information - info is supplied
maindomain.com/home - goal end point reached
I have set up a View for each subdomain e.g 'Viewing foo.maindomain.com', and each View has a Filter that accurately shows visits to foo.maindomain.com & foo.maindomain.com/inv/acc0unTt0k3n.
I don't know how to go about tracking traffic through this whole funnel. My ideal end-goal would be to track this funnel for all subdomains combined, but I would be satisfied for now with getting a Goal or Funnel that worked for each subdomain individually.
Inside my 'Viewing foo.maindomain.com' View, I have attempted to create a Goal to track this. I can capture the first two steps by creating:
Goal Type > Destination
Destination: /inv/
Funnel: /
This gives a 20% conversion rate, which matches up with my server data for account creations. But if I try to change the Destination to maindomain.com/boarding, and add /inv/ as another step in the Funnel, it no longer works ("Verify this Goal" returns 0).
How can I create a Goal that captures all of these steps?
Make sure you are using the same UA code on every subdomain.
You should then just be able to see all the subdomains in the standard view out of the box - UA tracks across subdomains automatically. See the Google documentation for details
You don't need to set up a view for each subdomain if you don't need it.
Name your master View "Rollup" if you like.
You can see all subdomains in your "Hostname" report for that view.
You may want to overwrite your pageview names so they also incude the subdomain, so you can tell them apart (if say subdomain1.domain.com/index.html and subdomain2.domain.com/index.html exist, in the standard pagetracking they will be aggregated) - this can be done via filters:
Filter Type: Custom filter > Advanced
Field A: Hostname Extract A: (.*)
Field B: Request URI Extract: (.*)
Output To: Request URI Constructor: $A1$B1

Google Analytics Custom Filter Not Reporting Correctly

I have created a Google Analytics profile for one of my domains to filter my reporting for a single URL string parameter: "id=21", but I am still receiving unwanted ids such as "id=19" and "id=30". How do I get ensure only "id=21" is the only one showing? I am fairly new to this process, so please go easy on me.
My analytics configuration:
Filter Type:
- Custom Filter
- Include
- Filter Field: Request URI
- Filter Pattern: id=21
- Case Sensitive: No
Thanks!
Matt
You've set up the include filter, but you don't have any exclude ones. Have a look at this video, there's a thorough explanation.

How to modify page URL in Google Analytics

How can you modify the URL for the current page that gets passed to Google Analytics?
(I need to strip the extensions from certain pages because for different cases a page can be requested with or without it and GA sees this as two different pages.)
For example, if the page URL is http://mysite/cake/ilikecake.html, how can I pass to google analytics http://mysite/cake/ilikecake instead?
I can strip the extension fine, I just can't figure out how to pass the URL I want to Google Analytics. I've tried this, but the stats in the Google Analytics console don't show any page views:
pageTracker._trackPageview('cake/ilikecake');
Thanks,
Mike
You could edit the GA profile and add custom filters ...
Create a 'Search and Replace' custom filter, setting the filter field to 'Request URI' and using something like:
Search String: (.*ilikecake\.)html$
Replace String: $1
(was \1)
Two possibilities come to mind:
it can take a while, up to about 24 hours, for visits to be reflected in the Analytics statistics. How long ago did you make your change?
try beginning the pathname with a "/", so
pageTracker._trackPageview('/cake/ilikecake');
and then wait a bit, as per the first item.
Usually you have the ga script code at the end of your file, while special _trackPageviews() calls are often used somewhere else.
Have you made sure you have your call to pageTracker._trackPageview() after you have defined the pagetracker?
Like this:
var pageTracker = _gat._getTracker("UA-XXXXXXX-X");
pageTracker._trackPageview();
otherwise you just get a JavaScript error I suppose.

Resources