Using UTM parameters with current queryparams - google-analytics

I have a page which gets some queryparameters from another page. Just like this:
https://sampleurl.com?foo=bar&tomato=yes
I am trying to use google analytics through UTM parameters. And I append these parameters to the link as this:
https://sampleurl.com?foo=bar&tomato=yes&utm_source=facebook&utm_medium=post
My analytics team says that these don't work and UTM parameters should be positioned right after the base url like this:
https://sampleurl.com?utm_source=facebook&utm_medium=post&foo=bar&tomato=yes
I mean these are query parameters, positions of these should be irrelevant but I couldn't find any information about the subject saying that the parameter positions are relevant or irrelevant.
Are they relevant for Google?

It is a best practice but it is not relevant.
Here is a test that I carried out:
https://www.my-website.com/?utm_source=test1&utm_medium=test1&param1=1&param2=2
https://www.my-website.com/?param1=1&param2=2&utm_source=test2&utm_medium=test2
The result in Google Analytics:

Related

Can't configure a goal in Google Analytics

I have problems configuring a very basic goal in Google Analytics.
My goal page is: https://www.lifeconnections.pe/?action=ff1
I configured the goal as a destination and regular expresion using "/?action=ff1" as the goal text
In Google Analytics the "/?action=ff1" appears as the page visited in the "behavior>site content>all pages" report
Even then, the goal is not being registered.
What can be the error I am making. In Google Analytics documentation can't find the error.
Thanks,
Try to use your string value defining contains instead of regex or try to set this value for regex:
\/\?action=ff1

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]);

How to Track Store Locator Search terms in Google Universal Analytics

I am in the process of setting up enhanced Ecommerce for GA and have had a few requests of additional of what else the client would like to see in their reports. Once of which is
"Where can i see a report if the locations that a use types in when they use the store locator"
There is already an internal search functionality thats been set up and is tracking the search terms people are typing when looking for products, but i'm not sure if i would need to set this up as a second search terms report or if it's something different?
The URL of the page is different to the internal search results and is www.domain.com/store-locator#wales|GB|0|0|0
Any insight into this would be really helpful.
Thanks,
Roxi
As to me knowledge, you are not able to use bookmarks (#something) in GA for internal site search setup. Only GET and POST parameters are allowed. In your situation I think the best solution is to use GA events to send the data about used location each time the user is using this functionality. You need to include addition ga() function call to track those events. Info about how to set it up you could find here: event tracking. After setting things up, you will see all the info about number and type of called events in Behavior -> Events reports section in GA.
Example code:
<button onlick="var hash_location=window.location.hash;ga('send','event','Locator',has_location)">Click me</button>
With such function new event will be send to GA with Event Category=Locator and Event Action=hash in the url. You have some complicated hash, so most probably you need to extract first some info from this using regular expression. Example to get first item from |-separated list in the hash:
var pattern = new RegExp('[^#|]+');
var hash_location = pattern.exec(window.location.hash)[0];

pagePath and nextPagePath in analytics api not working

I try to get a list of pages people go after visiting the selected page. pagePath is a starting page, nextPagePath is the result list of pages I'm interested in. I included a filter to show only one starting page. But the result I get is confusing:
What am I doing wrong?!
Use ga:previousPagePath instead of ga:pagePath. For the reason to me unknown, ga:pagePath and ga:nexPagePath refers in GA API to the same thing.

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