Hubspot and Google Analytics - Pass session source and medium information - javascript

I’m trying to pass session source and medium information into HubSpot so that if a form is filled out / some other conversion event happens, I can tell where that specific session started.
From the HubSpot side, this should be a two-field solution — e.g. the session and medium get passed across into fields that update with each new visit. If a form gets filled out, it will copy the session and medium data across to more permanent fields.
The end result of this process will mean that I’ll be able to say “we got 100 people to download our ebook this month. 8 came from email, 70 came from organic search, and 22 came from social media”.
All I can say right now is “we got 100 people to download our ebook. I have no idea where they’re from.”
I would like to know if this would be possible to do using Google Analytics and Hubspot as well as some script.
Upon researching I have found these two scripts that may be relevant to this:
https://github.com/troyfawkes/dgacquisition
and this:
http://sbjs.rocks/#/
Any help would be greatly appreciated.

sbjs works great for this if all your campaigns have proper utm tags.
However, you might have set this up the other way and send a specific event to Google Analytics each time a user fills a specific form. then you can set up a goal for that event and use Acquisition reports to answer your exact question "where my conversions come from?"

Related

Google analytics - difference between analytics data and the data from the core platform

We use Google analytics with Google Tag manager for our ecommerce platform based to track the conversion, etc.,
In the thank you page, its used to track the order value and the revenues.
Consistently we see a difference of about 15 to 20 % difference between GA data and the data from the core platform.
Tried to find a pattern among the missed orders but couldn´t ascertain one easily. The GA recorded orders include devices like Desktop, tablet and mobile and we see different browsers too.
Need inputs to analyze this better.
Note: Thank you page is loaded by a redirect from the payment gateway system
15-20% difference is not good at all. Google says you should expect better than 95% accuracy, and to keep at it if you're not getting those numbers.
Note: The more "techy" crowd that your website has, the more folks you'll run into "Do not track" or with Ad-Blocking tech in their browser. Normally, you'd want to try to baseline that difference using device category filters to see if the gap is bigger for desktop (most phones/tablets don't use ad-blocking).
First, question. If the user lands on the thankyou page, and hits the refresh button, does it send another "conversion" to GA? IF so, you want to make sure that you build in logic that prevents duplicate conversions to be sent if the user was not making duplicate purchases. A browser refresh is not a purchase, don't record it as such.
Second, if the page takes forever to load, or you have users that have bad internet, then that could increase the difference. They might be closing the browser or exiting site before GA client has a chance to send the final conversion to the server. So how is the performance of your thankyou page?
Are you sure you're looking at the correct business data? I've been told GA numbers are off by the business before and it turned out they messed up their own query in the transaction system (and they had been doing so for years!). It is a long shot, but if you feel super confident about your GA measurement setup, then run it by the folks giving you the transaction numbers.
Finally, if you can't get the difference down then move to the Measurement Protocol server-side implementation of GA. You simply need to record the IP address of the user and their GA client id, and then construct an HTTPS GET request using the Measurement Protocol fields for a valid hit. Server side measurement is the most accurate way to do this, but requires code updates in the ecommerce platform itself.

Implementing CPA affiliate purchases in GTM enhanced ecommerce

I'm implementing Enhanced Ecommerce on our (mainly affiliate) website through GTM. We have list views and detail views etc.. so implementing impressions and clicks is easy, but for affiliate purchases there is a problem.
We have two payment models for the shops that are showing their products on our site:
Cost per Click. I can implement a small purchase on the clickout page.
Cost per Acquisition. Here is the problem: The purchases are made on a different website on a different time. Using PHP API's I get the purchases made a few times a day through a cronjob.
How can I create a purchase (preferably using PHP, using javascript is messy on a cronjob) but retain the cookie value so I can link the purchase to the clickout and channel people used to get on our site.
I thought of creating all zero purchases for each clickout and maybe repurchase using the same transaction ID. This might work, but we will end up with thousands of empty purchases.
I ran across a similar problem a while back. Our checkout lives on a different domain. So when Adwords people would checkout after migrating to Universal, I was losing that data at checkout. I think my solution there could help you. This all assumed you're using Universal Analytics and not the old deprecated libraries.
The first thing I do is grab the GA cookie, which is named _ga. Inside it is your GA session. It looks like this (it will be much longer)
GA1.2.3456.7890
The third and fourth number sets (including the period) are the session itself. Parse them out.
Now you want to find some way to store this with the user. I used my PHP session (we pass it in the query string when we jump domains) and stored it there. You'll have to figure something out that works for you here.
On the other site we need to specify the GA session and site within the GA block. Please note that the new site will report these visits as if they belonged to the original site. The UA-XXXX-Y should be from the original site and yourdomain.com should be the new site TLD
ga('create', 'UA-XXXX-Y', { 'cookieDomain': 'yourdomain.com', 'clientId': '3456.7890' });
Now you can pass your purchase metrics in. When a session converts on the new site, the old site will track it, along with any other things that session held (i.e. page impressions, Adwords clicks, etc.). You don't need any messy cron jobs to do this. Just be aware, as I said earlier, that these page visits belong to the original site as far as GA goes. You could try reporting two sets of metrics to get around this, but I have not tried that.
Reading the comment beneath the answer from Machavity, i assume that you are using Universal Analytics, or else Universal Analytics is the way to go!
I have had a case in the past where we had to think of a one way tracking system because we didn't have access to the other site's code.
Give a look at the Google Measurement protocol. This protocol makes it possible to send raw userdata directly to google analytics over HTTP.
Link to Google measurement protocol

Incorporate LinkedIn to a webpage

I'm trying to create a webpage that can incorporate LinkedIn info's (profile,people,company, etc...).
The things that it can/would do are the following:
When the user enters a name that is registered in LinkedIn, he gets the following
*Name, Company, Email
*List of LinkedIn messages that are waiting for reply
The same process goes on everytime the user adds a profile, I'm planning to use the Profile API of LinkedIn to get the Name, Company and Email but I can't find a working example to be my basis.
As for the 2nd one I still don't know how to get the LinkedIn messages.
Here's my Layout and expected result.
How can I achieved this? Opinions and Suggestions are highly appreciated tnx
This is far to broad a question for me to invest the necessary time in to figure the answers (multiple) for you, but do let me give you some hints. First of all, from my experience with the linkedin API not all the data you wish to access is available (do double check this though, I used the API quite awhile back and stuff might have changed in the meantime). As this data is not available through the API the only alternative would be to somehow bypass the cross domain policy, which in conclusion would require the user to install a chrome extension/firefox plugin which will function as a proxy for your application or even 'better', make you entire application a browser plugin based web app. Not that I am a fan of those whatsoever but if you application is meant in any way whatsoever as a linkedin (dedicated) plugin (probably as part of a greater service you're developing) then it might make most sense.
The whole system you are describing is very long winded and requires a large amount of development time. Alot of the data is not accessible directly or indirectly too. You cannot get email address's out from the API as a security feature (bots could just harvest emails for marketing campaigns).
First of all, you will need to make an application that allows for oAuth2 connections with the linkedin API service. People will log onto your website, click to join their linkedin account with your website and your website will receive back an access token to do the calls.
You will then need to build the queries which will access the data you require. The linkedin API documentation (http://developer.linkedin.com/) isn't greatly indepth but it gives you a good understand and points you where you need to go. There are also a couple of pre-done php API's around such as https://code.google.com/p/simple-linkedinphp/.
I have worked with many API's from twitters, facebooks and LinkedIn's and they all require a lot of back-end work to make sure that they are secure and get the correct data.
It would take me hours to go through exactly how to do it and has taken me many hours to get a solid implementation in place and working with all the different calls available.
If you have minimal coding knowledge, it would be best to go to an external company with a large amount of resources and knowledge in the field who can do it for you. Otherwise it may take many months to get a working prototype.

Add UTM parameter based on events

I know that it's best to add Google Analytics UTM parameters externally for incoming campaign traffic.
However, when dealing with a juggernaut of an IT team who like to say "no" a lot I'd like to attempt to arm myself with a solid response. Analysts will feel my pain in trying to convince others to track campaigns the correctly, rather than by listening to a non analytics users advice of just creating segments based on URLs.
There will be a campaign running where a visitor to the website will input a promo code in order to get a free thing.
For whatever reason we cannot tag the incoming traffic or the links that will lead from the promo source with our UTM parameters.
I can create an event in GA for when a visitor enters a promo code that relates to the campaign in question - the URL generated will contain the promo code int he URL, thus allowing me to create an event.
Is it possible in Google-Analytics, combined with a lateral thinking developer, to overwrite the UTM parameters based upon a click event halfway through the visitor session? Could a script do this?
Any other ways around it?
We do have Google-Tag-Manager at our disposal too.
Doug,
Sorry to dissapoint you, but any overwriting based on events (or any single-hit action by user) won't work correctly and would lead to skewing your data anyway. See this brilliant post by Joshua.
What you could do however is to use CustomVar or CustomDimension (on session level probably), which would substitute UTM parameters. So if there is a promo on your werbsite, you can assign some value after users click on it.
Then by building a custom report, you should be able to use this with no restrictions, just instead of medium/source pick your customvar/customdim.
Hope this helps.

google+ page vs profile

I have an Asp.net webpage where I would like to display google plus information of the users. The google plus IDs are stored in a database. Is there a way (javascript/C#/VB) to determine if a google plus ID is related to a page or a profile? because I have to include different g:plus codes for them. I searched the google developers page but couldn't find anything related to this. Thanx folks!
I just got figured it out how to do this. Maybe someone will face this problem, so here is the answer. There is the REST API's people get method. If the userId that you target is that of a Google+ page, there will be an objectType attribute with a value of page. You can see this in action here. Just submit the query and look at the result response. You need an api key for your requests, this key has a limitation of approx. 10000 request/day. Here you can registrate and obtain the api key.

Categories