how to track conversion without users viewing a page? - javascript

I have a website where customers may submit orders and I have Adwords campaign on it.
However, they may not necessarily proceed with the payment of the order.
I'd like to track my final conversion on google analytics such that my ECommerce transactions are tracked only when the customers have paid and informed us offline.
How can I track the following conversion:
1. User clicks on Adwords ads.
2. User browse website. <-- Already tracked in analytics
3. User clicks 'Purchase'. <-- First Conversion
4. User makes payment and inform us.
5. WE update our website order systems with payment information. <-- WANT TO TRACK THIS
PLUS: I wish to consider number 5 as the ultimate conversion not only relating it to number 3, but also number 1! Is there any good way to do this?
Specifically I am not very familiar with the details of the tracking flow enough to manipulate the important variables to submit to google by myself. I'm worried about things like what if at step 5, the IP address that request to Google Analytics is not the same as that of the users' in step 1, will the 'source/medium' tracking be broken?
Hope someone may know of any idea or even a help page specific to my case can help.
Thanks!!

To answer the questions, no, there is not a good way to do this and yes, source/medium tracking will be broken albeit for a different reason than you think.
GA does not use IP adresses for tracking (in some countries using IP adresses isn't even legal). The Google code assigns a visitor id to recognzie a user (more precise, the browser - ids are stored in a cookie) and session ids to the visitor id to recognize recurring visits. Also the code stores a lot of information in the browsers cookie, among other things source and medium.
To do what you want the user would have to look at the Google analytics cookie in his javascript console, send to you at least the visitor id, session id, timestamps, source, medium etc. Then you would have to create manually a gif request that sends that data to the Google server.
To avoid misunderstandings, I'm not suggesting that you do that, I'm telling you why there is no good way to do this. It's better to use Ga for the things it was designed to do and look into CRM systems or something if you need to track conversions offline.

Related

Tracking purchase of particular product on different sites

I have a website on which other websites owner can list their products. For listing the product they need to manually create the product by providing title, description, image and link of products.
When any user will visit my website he will be able to view these products and on click of any product he will be redirected to the owner's website and purchase will be done on his website.
Now I need to build a functionality by which I can track the complete transaction of the sale of that particular product, that particular product has been sold or not.
Whenever any site owner is coming on my site to list his product he needs to first register on my site.
After registration, I can provide him a chunk of a script that he needs to put on his site header.
Apart from this, I cannot modify his site. And I just need to track the particular product's transaction.
I have searched and found that Trivago and Skyscanner are using something like this.
I have tried to create some scripts in JS but couldn't track the desired things, as sometime user does not purchase my item and I did not know about this. In some sites, thank you page does not have enough information about the sale to capture.
If that can be possible just by adding few more things on Marchent's website please let me know.
To make sure that your Postback works on all platforms and providers, you must provide more than one way to your merchants to implement on their websites.
JS script ( you already done that )
Server to server implementation (S2S callback) - where you send the order id in the headers or get parameters, and the merchant must provide it back.
Example: you send your traffic as below format:
http://merchant_url.com/?tracking_id = 123123123
The merchant returns back when a purchase is made to your tracking url:
http://your_tracking_url/?merchant_id=1&tracking_id=123123123
This way you can identify your traffic
1px iframes, that load on their thank you page and they pass the click order_id parameters
Example: your merchant should place something like the below on their thank you page:
<iframe src="http://your_tracking_url_iframe/tracking_id=123123123"
style="height:1px;width:1px"/>
lastly, even 1px image elements are usually also used in such cases.
Example:
<img src="http://your_tracking_url_img/?tracking_id=123123123" style="height:1px;width:1px"/>
This way, even if merchant is using simple html/js on their thank you page they can always load your iframe with the specified parameters which will help you track a sale.
Hope this helped.
You can use cookies for an easy implementation.
Because the end client need to come from your website he should have your cookie with a userId and a productId before he goes to an other website.
On the thank you page of the other website there should be a call to your server (usually a 1px image). Server side you will have the same cookie and the website as referer.
Then you can say to the website how many clients bough after clicking on a product on your service. (Be sure to count sells only once per user!)
If the website want a cross validation they can provide you with the IDs of products bough when they call so you count only when the IDs match.
This is complicated, not because of the technology involved, but because of the variety of commerce solutions out there and the open-ended nature of human choice involved.
It sounds like you have secured two vital components to make this work: the ability to identify registered merchants and the ability to place a script on their webpage.
There is a third component you need, I think; either an agreed upon interface for that script (once a commercial transaction is completed or failed, hand the object with statuses back to your script through a specific triggered event) or full knowledge of the events for the merchant's website that you can code to.
Coding for the unknown will require a lot of time and effort as you would need to learn each merchant transaction solution and how to capture the transaction data. This will be... a long haul and I don't think it would be very successful.
If the merchant site is willing, they can trigger an event that your script will be listening for and pass along the transaction data to it, which would allow your script to pass along via AJAX to a waiting tracking page to record the results. This is simplest in terms of reaching an agreement and for the work involved, from your indicated starting point. jQuery is an excellent library for wiring this all up and there are other options.
Part of tracking would be passing along a token that ought to be carried through the transaction and passed back, generated by your site on the click to said merchant's website and passed on from there. Once you get your token back, you can compare it to a database of transaction tokens to find out which event had what result and fill in the appropriate fields from the resulting data.

Google Analytics: how to use custom dimension on different website to identify intranet users

SITUATION
I have a main public Liferay website, that is therefore accessible both by intranet and not-intranet (i.e. public) users.
I also have a Liferay intranet website, which is accessible only to intranet users because is protected via a login page.
The login page to the intranet website is public.
After you successfully login, the intranet website is loaded.
EXPECTED:
In my Google Analytics account for the main website, I want to differentiate intranet users from public users (e.g. in order to understand how the 2 categories behave).
Questions
Can I use a custom dimension to solve this problem, or is there a better way?
Custom dimension data has to be sent via hits (UPDATE: by "hits" I meant either pageview or event hits, I am not referring to the dimension scope, cfr. https://developers.google.com/analytics/devguides/collection/analyticsjs/custom-dims-mets), therefore I should:
load the Google Analytics tracking code of the main website on the intranet website (the site displayed after successfully logging in)
send a pageview hit from this Intranet website to the main website together with a custom dimension, e.g.
ga('send', 'pageview', {
'dimension1': 'I am a intranet user'
});
Is this correct?
Does the above mentioned solution have any impact on my Analytics data in the main website (e.g. more pageviews due to the tracking code added to the intranet website, or strange behaviours in counting user sessions, etc.)?
Thanks a lot.
UPDATE:
Actually, the solutions proposed below would not work because the 2 websites (intranet and not-intranet) are considered different domains.
So, even if I had the following domains
intranet website: http://intranet.mycompany.com
company website: http://www.mycompany.com
and I sent data to the same UA account (i.e. the company website UA account), they would be counted as different visits.
Quoting Google (see https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingSite#profilesKey)
If a user independently visits two sites that are tracking in the same
view (profile), such as through a bookmark, these visits will still be
counted under separate sessions. In this scenario, the linking methods
are not invoked, and thus there is no way to determine the initiating
session for a given user.
So, how could I solve my problem?
Would it be possible to solve it by implementing cross-domain tracking (https://support.google.com/analytics/answer/1034342?hl=en), and how?
Thanks a lot.
Can I use a custom dimension to solve this problem, or is there a better way?
Yes, custom dimension is perfect for this.
Custom dimension data has to be sent via hits
The User-level scope is more appropriate than the hit-level one for what you want to achieve. The linked document explains in detail why, and gives an example similar to your use case.
Does the above mentioned solution have any impact on my Analytics data in the main website
Yes, impact is mainly that you will have extra data corresponding to the visits to the intranet.
A custom dimension works well for your purpose. You will get additional hits for visits on your intranet site, but you can segment them out via the custom dimension to separate between inter/intranet.
Since the intranet requires a login there is one other way you could try, which would have the additional benefit of allowing for cross-device tracking (if that is beneficial to you).
Google calls this "userID", despite the fact that it must not be used to identify individual users. On login you pass in a unique value per user that is set by your backend system (UUID format is suggest but any unique string would work). Since it is not assigned by the tracking code but set by your system it will be the same id on every device. It is used to de-duplicate users, i.e. persons that log in from multiple devices will be recognized as single users (also useful if people delete their cookies - the userID can be used to aggregate sessions into unique visitors).
To make this work you need to set up a special view that contains only data from visits where the userId is set (so you would have a view for your public site and a view only for your logged-in users). You get a few special reports, for example one to tell you how many users log in from different device categories.
What the userID should not do, and in fact must not do according to Googles terms of service, is to identify individuals. The userId is not exposed in the Interface, and you must not store it as a custom dimension. If you store it on the client side in a cookie you must unset it once the users log out. It is merely there to allow continuous tracking of users independently from cookies (plus you need to amend your privacy policy if you want to use this).
Of course you can combine both approaches to get even more insights.

Cross-domain conversion tracking - Custom vs GA?

Say I'm starting a site, refer.com, where I post items on an 'affiliation' basis. When users click on my links, they're directed to the site shop.com. If the user I redirect to shop.com makes a purchase, I need that conversion tracked.
I see two possibilities:
Creating a custom tracking library (probably JavaScript) where I
request URLs from refer.com to transfer information from shop.com. I guess PHP would work too, but reduces compatibility with clients.
I use Google Analytics cross-domain tracking to do this. I don't
want the refer.com GA account to interfere with the shop.com GA account, but as I understand it you can use several accounts on the
same page, giving them different identifiers.
I feel like I'm stuck with a narrow set of possibilities. Do I do both? Neither? I need it to be as easy to implement as possible for the client, while also providing relatively bullet proof tracking. What's the standard today? Affiliation services are everywhere, and this type of cross-domain tracking has to be a very used technique. Is there another preferred method of achieving this that I'm not aware of?
This question might seem highly theoretical. While that may be true, answers with code are highly appreciated too.
I have a way for this to work but it requires both your domains to have the Universal Analytics code installed. This will not work with the older GA code
https://support.google.com/analytics/answer/1032400?hl=en
You can install multiple instances of the Google Analytics tracking code on your web pages to send data to multiple properties in your account.
You can, for example, install multiple instances of the Universal Analytics tracking code (analytics.js) on your web pages but only one instance of the Classic Analytics code (ga.js).
So (provided they have your GA code installed) when you refer to shop.com what you should do is this
Parse your GA cookie. You can get to it by $_COOKIE['_ga']. The cookie holds a string that has four parts, broken up by periods. (i.e. GA1.3.367110421.1357220305). You want those last 2 numbers (in this example 367110421.1357220305)
Pass the parsed cookie data in your referral to shop.com
shop.com should store the parsed cookie in its session
Last but not least, when shop.com has your referral data it should load your GA code and set your sessions up like this
ga('create', 'UA-YOUR-GA-CODE', {'cookieDomain': 'shop.com', 'clientId': 'USERS-PARSED-SESSION'});
What this does is it passes your GA session to their domain. At this point, GA will keep their session going so you can track what happens on shop.com. Any conversion data they pass to their GA code should be passed to your GA as well.
Is it bulletproof? No. You have to trust shop.com to properly retain and show your referrred GA session ID. But I have to use this methodology to keep my sessions between my primary sites and the centralized checkout we use and it preserves my Adwords conversions, etc.
I feel like if you're looking for ease of use for the client, Google Analytics is a pretty solid option. It is a widely used tool, with lots of documentation and active forums for feedback. Also, from my research on the topicit seems that they've got this type of behaviour in mind already.
An alternate that comes to mind is that, when redirected from site A to site B, they should be forced to authenticate on site B. You could then setup an authentication form that is unique to this referral from site A, and will be filtered into your database separately from regular authentications on site B.

Can Piwik report referrer in real time?

I am looking to query Piwik API in real-time to get stats on the current visitor. For example, I have a javascript file that'd I'd like to fetch Piwik API JSON with to get info on the visitor who is using the page which contains the javascript file (referrer, mobile/desktop, location etc.)
As far as I understand Piwik must have this data to generate analytics on per-user basis. My fear is that it might not actually allow querying this info in the way I've described above. If that's the case, what can I do to obtain it from PW? Obviously API method would be better, but if not I'd like to use the same system to make real-time reports as the one I use to generate stats on the groups of the users this particular one belongs to.
According to their API page, the PIWIK Live! widget refreshes every 5 seconds, and displays new visits. For each visitor, you can see:
date
number of actions
time spent on the site
country
browser
operating system
whether the visitor is new or a returning visit
the referrer used to access your site (Search engine & keyword, Campaign,
or Referrer website)
whether the visitor converted a goal
You can query the Live! API Module and the use the Live.getLastVisitsDetails method to get the data you asked about.

Can I associate a user's account with an action to the drive API?

We're looking to make a little webapp to manage our week-long nerf war (humans vs zombies to be precise), and we're thinking about how easy it would be to have Google Sheets be our only backend, and our frontend be entirely javascript/html/css.
Let's say there's two actions that can be done in this javascript:
Register, which adds a row to a certain sheet.
Report tag, which adds a row to another sheet.
Let's say we have 100 players. We'll have each player sign in using a google account. Is there a way that for either of those above actions, we can have sheets know who made that action?
This way, if someone gets hold of the API key and spoofs their referer to make bad requests, then we can know which google account did it and ban them from the game.
For example, if I open up my sheet and say "see revision history", I want to not see one user for all the revisions, I want to see the user who triggered the action.
Is this a reasonable approach, and is it possible? Thanks!
(note: i know these two actions can be done via google forms, which can associate the user's account, but imagine we have more complex actions that cant be achieved with just a google form)
The short answer is no. You'll be using the spreadsheets API (NOT the Drive API) to update the sheet.As far as Google is concerned, the "user" is your application, regardless of which human was driving the application at the time. Your application knows who the human is, and so it is responsible for logging any audit info that your use case may require.

Categories

Resources