How to pass GCLID from page to page - analytics

We have a site that gets traffic from adwords. When adwords link clicked landing page of the site have gclid=xxxx extra parameter to track stats.
After landing page, if user navigates away from that page (still staying in the site) gclid parameter are not added to following page URLs.
I checked some other sites' adwords campaigns and saw that gclid remains in the URL no mater how many pages navigated.
Is this a feature by adwords or do I need to pass gclid parameter manually from page to page?
If I need to pass manually, is there a way to accomplish this with javascript? Because it is very hard to edit the CMS framework to add the parameter for all the links.
Note: Our advertisement company tells they are observing too many "direct/none" source in analytics and claims that this is because of the gclid parameter not passing through pages. Do you think is this the case

Your post contains a number of questions:
Is this a feature by adwords
No, Adwords offers no such feature.
If I need to pass manually, is there a way to accomplish this with javascript?
Yes, you could check for the existence of a gclid parameter in the document's URL and dynamically append it to any internal links on the page. But that's not required (see below).
... too many "direct/none" source ... because of the gclid parameter not passing through pages. Do you think is this the case
No, that's not the case. The linking between Adwords and Analytics depends on the gclid parameter being present on the initial hit of a session, where the Analytics script will pick it up and associate it with that user. Going forward, any direct hit from the same user will still be attributed to Adwords (up until the campaign timeout is reached). Maybe this Google Analytics documentation page will clear things up.

You can store the GCLID value in Session Storage or Cookies.
Decode the GCLID value and keep it as a hidden value in any of the forms on your website.

Related

referrer in segment.io analytics.page() in a SPA

I am trying to integrate segment.io to work with Angular. My angular app is a SPA so I have to add some code to my components to allow segment to register the page visits.
In the code used to register page visits, there is a property called referrer that, according to the docs is:
Full URL of the previous page. Equivalent to document.referrer from
the DOM API.
The problem I am having is the referrer property value sometimes just remains empty, or sticks to one page even if I move to several other different pages.
So my questions are:
Does referrer mean links outside my app or also the previous routes visited within my app?
Am I supposed to set this manually in the app?
Yes, you're supposed to set it manually in your existing pageview hits to Segment.
Basically, in your case, referrer would be just the previous route. If the previous route doesn't exist, then use the document.referrer.
And yes, organically, if your app doesn't have a previous route, then document.referrer may contain an outside url, which is completely fine and expected.
Also, Segment provides pretty neat support for questions like this, so you can confirm with them.

How can I set in code page ID to be detect in google analytics?

I need to give any page in my website a unique ID to be detected in google analytics or firebase analytics.
I will explain:
First of all, I'm developing using React.js.
I have lots of pages (routes) on my website. for example:
https://mywebsite.com/website1
https://mywebsite.com/website2
https://mywebsite.com/website3
In someday, I will change the route of the page and I want to keep detect the analytics data from the history using API.
Because of that, I need to set a constant ID for each page to be detected no matter what the route is.
You can do it by creating a datalayer variable - if you kept the datalayer the same on the page (even if the URL is different) you can send the variable as a custom dimension to Google Analytics. You can then report on that custom dimension as if it was a page.

How should a React app (or any SPA) interact with a HATEOAS back-end?

The basic question is if there should be one HATEOAS entry point per page or one entry point for the entire app?
Most examples I have seen implement a single page with a HATEOAS backend, e.g. a list that is paginated using prev and next links. But what happens when the app navigates to a different page that has completely different capabilities and needs a different entry point? How does one organize such an app?
Concrete example: We have an app with tab navigation. The home tab shows a product catalog so the entry point is /products which returns page 1 of products along with pagination links. However, now I click on the orders tab which must show a list of past orders. This page needs a completely different entry point /orders which the home tab knows nothing about. In fact, user can directly navigate to the orders tab using a deep link.
How to think about this problem? Are there any examples illustrating an approach?
There's a few different ways to solve this. Here's two:
The SPA takes context from the uri (such as an id), and uses it to search on the API. The API can describe templated links/actions to search for resources by their id.
Instead of doing client-side routing, let the server decide what to render.
We're going more towards #2. If we have a uri such as:
https://spa.example/https://api.example/foo/bar
We take the path part of this uri and hit the API. Based on what the API responds with, we decide what to render. This means that most of the routing for these kinds of endpoints is delegated to the server, which feels more in line with HATEOAS.
The path part in this case is an entire absolute URI, but we also support relative uris and have a default base uri. So in practice these two uris are equivalent (for our SPA):
https://spa.example/https://api.example/foo/bar
https://spa.example/foo/bar
We develop & use ketting / react-ketting to do most of the heavy lifting

Piwik, Export count of page visits for a specific url

I Make artificial page views with javascript on my website using javascript, because I need to track them later
piwikTracker.trackPageView('/lid/902095/website');
I need to be able to export how many times the above code was executed, i.e. how many times /lid/902095/website was visited, so that I can show some stats on my website, however I'm not sure what my query to the API should be, here is my attempt:
?module=API&method=Actions.getExitPageUrls&idSite=2&period=day&date=today&format=JSON&token_auth=anonymous&segment=pageUrl=#%2Flid%2F902095%2Fwebsite
It returns an error at this time "Error: The report 'VisitsSummary_CoreMetrics' was requested but it is not available at this stage. You may also disable the related plugin to avoid this error."
I don't see a plugin with that name in plugins section, my active plugins are "Actions, Dashbord, DoNotTrack, ExampleAPI, ExamplePlugin, Live, Login, Widgetize"
Not sure if this is the right query to send to the API or not, any help is appreciated.
If you want to track the visits use this api call
?module=API&method=VisitsSummary.getVisits&idSite=2&period=day&date=today&format=json&token_auth=anonymous
by default VisitsSummary plugin is provided
Piwik Web Essentials is a good book for reference.

Tracking adwords performance on a site using Backbone Router

So we just relaunched our site as a Backbone powered single-paged app, but we're having a heck of a time tracking our conversions from our AdWords ads into the site with Google Analytics.
The problem is that in order for Google Analytics to track the fact that the user came in from AdWords, it looks for a URL query parameter called gclid in the URL:
http://test.com/?gclid=(Q#kjsdf0INKJSDJF9
But, when the Router from Backbone initializes, it removes all the query parameters from the URL, so when the tracking event fires, it doesn't see that the user came from an AdWords ad.
We tried sending the user to an interstitial page that loads the analytics code and waits for the event to fire and then forwards them into the site, but
Its ugly and shows users a blank page for a while
Doesn't work without a significant wait for IE8 users (who make up 50% of our user base sadly)
We contacted Google's AdWords help to see if we can manually give the gclid to Analytics and their answer was
You should hire one of our consultants who will figure out how to keep the URL parameters on your site so it works correctly because we do not support manually setting the gclid ID
(Sadly only a very minor paraphrase.)
Google-fu leaves me blank in this respect -- lots of people asking questions in the Google forums, but no answers.
I don't know how everything is setup, but Backbone might not be seeing that URL with the parameters as a match, or a route that it knows about. In fact, you can test that by doing something like...
unless Backbone.history.start(pushState: true)
window.location = someDefaultURL;
If you wanted just a simple way to match routes with params, here's two ways that you could do it.
class MyRouter extends Backbone.Router
routes:
'test?*params': 'test'
'testTwo?gclid=:gclid': 'testTwo'
test: (params) ->
console.log 'test route', params
testTwo: (gclid) ->
console.log 'test route two', gclid
So the issue here is that I was immediately pushing an entry into the history object with the navigate method.
This overwrites (correctly) the current URL and does not preserve URL parameters (although it would be nice if it could, I guess that's a pull request I should make).
By not calling navigate immediately this allows the URL parameter to stay in the URL long enough for G.A. to see it.

Resources