We want to track the utm_source and utm_medium on Google Analytics on one of our clients site. We also want to get the conversion of the ad.
We can:
ga('send', 'pageview'); //Using our tracking number
This would work perfectly but our client will no allow js code added. We are thinking of using http://www.google-analytics.com/__utm.gif but according to doc, utmcc should pass the cookie values.
Is there any way we can use utm.gif with static parameter values?
<img src="http://www.google-analytics.com/__utm.gif?....">
You can use email tracking it works though the measurement protocol which is the same as the JavaScript library uses.
<img src="https://www.google-analytics.com/collect?v=1&..."/>
You can build up the hits as you wish.
Related
I have a situation and I am not sure how to solve it.
I am using a script in Google Tag Manager to define where marketing sources are coming from (i.e. organic search, organic social, paid search, referral, direct traffic, etc.).
I am taking the data from that script and storing it in a 1st party cookie & first party cookie variable.
However, I need the data from the cookie to populate in the URL query string, similar to how utms populate in a query string when someone clicks a Google Ad.
For example, when someone clicks on a Google ad, they arrive on the landing page and the URL looks something like this www.examplesite.com/?utm_source=Google&utm_medium=ppc&utm_campaign=example
I need similar functionality to that. So in my example, if someone came from an organic search result, I would want it to look like this:
www.examplesite.com/?Source=Organic&SourceDetail=Google.
Is this even possible to do on the initial page?
Yes, there are a few ways of going around it. I will only highlight the most elegant option, but first, you don't need to touch your query string. You can override the string that is being sent to GA with GTM. It's a lot more elegant than tinkering with the user-exposed front-end. Here is how:
That's how you override your location dimension (dl) in your pageview tag.
Now the only thing that remains is to make that custom javascript variable returning a string that would be just your current url with the proper utm-params appended to it.
This is a very clean and non-intrusive implementation. You can also do it on a GA settings variable level, which may be even a better solution, depending on your situation.
Also, you can override your source/medium using an event, rather than a pageview, but be careful with events. A change of source/medium will force GA to generate a brand new session for this user. That is done to be able to build different attribution models on the same dataset.
I am using a 3rd party plugin service (POWr.io) to add elements to our online store built using Shopify. The plugin does not support script tags, so I was unable to add tags using the Google Tag Manager
I use a variety of plugins from this service, and I would like to be able to collect data on them, specifically measuring loading time for photo galleries, and setting up goals in Google Analytics for newsletter submissions.
I can add custom JS directly into the individual plugins (in this case a photo gallery), and I have loaded the Google Analytics Tracking Code Snippet successfully. I am currently using ga('send', 'pageview'); but I think I need to use a different command to collect loading time, I have tried following what is written here
However, I am not sure how to modify:
ga('send', 'timing', [timingCategory], [timingVar], [timingValue], [timingLabel], [fieldsObject]);
To get the results I need and into Google Analytics.
Likewise, for a form submission, I imagine I would need to use this:
ga('send', 'event', [eventCategory], [eventAction], [eventLabel], [eventValue], [fieldsObject]);
But, again, not sure what how to modify this for my use in a plugin.
Any advice anyone could offer would be greatly appreciated
To measure timing events you need to create a timestamp when the event starts, another when it ends, and the difference between the two you pass in as timing value.
timingCategory, timingVar and timingLabel are just arbitrary strings that appear as dimensions in your reports (like category, action and label in event tracking).
timingValue is:
timingValue integer yes The number of milliseconds in elapsed time to
report to Google Analytics (e.g. 20).
With user timings GA is not doing the actual measuring for you, you need to determine the time yourself and put it in as a metric.
I have the greatest trouble finding information about what I need. I guess I'm not looking in the right places since this is quite basic. Anyway.
Somebody somewhere has created a Google Sheet anyone with the link can access. I want to retrieve the value of a given cell.
I'd like to be able to do the following in JS from a simple web page (or server side in PHP, but preferably JS):
AGoogleApiIHopeExists.setApiKey("<MY_API_KEY");
var value = AGoogleApiIHopeExists
.getSheet("AJEIDNNS6886SDHSKN67HBS7BA6SD555DSHD")
.getTab("MyTabInsideMySheet")
.getCell("B:17");
I'm afraid I'm a bit naive to think this is possible...
If not, where should I look for more info?
Try reading through the Google Sheets API. It is a REST API you can use to access & edit Google sheets. You do not need their client libraries (Java, .NET, etc.)
If the sheet is private, you will need to use OAuth 2.0 to gain access through a user account.
If the sheet is public, you will be able to access it without login. Note though that the sheet must still be published before you can access it.
I did some digging to help you out. Try this endpoint:
https://spreadsheets.google.com/feeds/cells/<sheetID>/default/public/full/R1C1?alt=json
R1C1 refers to Row 1, Column 1. You can change this as needed. default refers to the worksheet (tab) ID. If you need a different worksheet than the default, there are other API endpoints you can use to fetch the appropriate worksheet ID.
Here is a simple jsfiddle which allows you to enter a few variables and see the resulting value.
I have a google analytics account for an asp.net application which determines one of many clients based on a queryString within the URL. The snippet for the GA page is located within the master page, so the GA code is consistent across all clients.
What is the most efficient process for getting a set of basic analytics through the GA portal, per client (per queryString)?
---Edit---
Off hand , but never accomplished, I want to know if I can set a variable var1 within the snippet that gets set to GA identifying a client, then get discrete but identical reports, per var1 on the users. So that var[0] .. var[n-1] = Visitors where n is the number of clients.
You can just push the unique query string (assuming it's some sort of uID) as a custom variable into analytics. If it's sequential, you can assign ranges to clients (once again, am just guessing what your setup is like).
Alternatively, you can use the uID as key and have visit frequency as the value. (here is some prototyping code to check custom var key values https://github.com/vly/js_ga_cvars)
Just remember, when you set the custom vars you have to push a pageview or event to actually pass it to GA.
If you have access to the GA Universal beta program, you have the opportunity to define custom metrics (in case of a numeric data) or dimensions which would make aggregation reporting a lot easier.
If the client is an individual person, this is not allowed by the google terms of service.
You will not (and will not allow any third party to) use the Service
to track, collect or upload any data that personally identifies an
individual
http://www.google.com/analytics/terms/us.html
I have a DNS, and each computer has a website to make different folders / documents accessible in a different way than just browsing to that computer. For example, \Media takes me to the media servers pages (Music, Movies, etc.), and \Aurora takes me to the media server's website. Instead of it displaying "Aurora" in the address bar, however, I would like to use a script to replace it with "Aurora - Media Server Website, (server information)." I would really like to learn this method, I tried to look somewhere and it mentioned JavaScript would probably be the easiest way to do this. This would be helpful if I actually knew JavaScript =p If there is an easier way to do this, that would also be much appreciated =]
In a nutshell, I want the address of a website, //Aurora, hosted on a local DNS server to appear as "Aurora - Media Server Website (server information)." What would be a possible way to implement this?
Just use the replaceState method of window.history in JavaScript like so:
window.history.replaceState({}, '', url);
(params are: data (object), title (string), url (string));
I do it all the time to modify the URL, to remove the query string when using AJAX.
If you want to change the hostname then you have to change the DNS so that the machine gets the name you want. You can't use spaces or parenthesis in hostnames though.
The closest you can come with JS is the history API which only lets you modify the local part of the URI.
It is not possible to change the contents of the address bar due to security reasons (Phishing websites would exploit this heavily).
I would suggest simply changing the title of the page.
<title>Title goes here</title>
If you want to change it using javascript (for some reason) you can do this:
document.title = "The new title goes here.";