Tracking Traffic With Same Domain but Different URL - google-analytics

My domain: hospital.org/app
2 Type of user:
- Patient
- Admin
Example URL for Patient: hospital.org/app/fp/main/PA_MedicationsProgress.php
Example URL for Admin: hospital.org/app/fa/main/Admin_Dashboard.php
Currently, I am tracking data for both Patient & Admin but I need to separate the data for 2 types of users here. The URL for the patient will contain "PA" and the URL for the admin will contain "Admin".
My current solution:
Example URL for Patient: hospital.org/app/fp/main/PA/MedicationsProgress.php
Example URL for Admin: hospital.org/app/fa/main/Admin/Dashboard.php
But this will require me to change the URL and set up different properties which are not integrated into 1 report. Is there any way for me to show the data differently for these two users without changes these?

You can filter or use a segment in the same Property based the currently URL: /fp/ or /fa/ without modify the page name.

Related

Is it possible to pass a special query parameter value to a WooCommerce product link?

I am looking to use WooCommerce in a bit of a strange way, and I'm wondering if there is any way to make this possible. Here's my desired workflow:
Step #1: From a different site subdomain, provide a link to a certain virtual product, but with a query parameter with a unique user id number.
Explanation: The user is at othersite.example.com, and they get a link to buy a product in a WooCommerce store set up with a wordpress site at https://example.com/product/virtual-product
However, this product will be a payment to unlock something on the othersite.example.com site which has its own user and authentication system. (Firebase)
Would it be possible to pass a user id from the othersite.example.com by way of a url query parameter and then have that included in the order info?
ie. From the othersite.example.com someone could be given a link to the product like this https://example.com/product/virtual-product?userid=00000000000000000, with 00000000000000000 being their user id at othersite.example.com.
Then if that userid query value could be included in the order, the following steps should be doable.
Step #2: Have a webhook that fires when the product is purchased, telling a server managing the users for othersite.example.com that the user with userid 00000000000000000 has made a successful purchase of that product.
Is there a way to accept custom values like this to the order? Or is this totally out of the scope of WooCommerce's functionality?
Thanks so much.
I believe that it can be done by using a redirection/link directly to the checkout page, like: "http://yourdomain.com/checkout/?add-to-cart=PRODUCTID&000000" (tested)
In the example, "checkout" stands for the name of your checkout page, "PRODUCTID" stands for the id of desired product, "000000" stands for the user id of redirected person in the other website.
Then you can add a hidden input field to the checkout page (into checkout form, so you will see this value in order) and using the URL you can assign the "000000" (user id) to the value of this field.
I hope that works. If you have any problems with implementation, you can ask me.
- Useful link for hidden input field addition: https://stackoverflow.com/a/42614905/11003615
- Useful link for getting value from current URL using JS: https://web-design-weekly.com/snippets/get-url-with-javascript/
- Useful link for getting value from current URL using PHP/Wordpress Core: https://wordpress.stackexchange.com/questions/274569/how-to-get-url-of-current-page-displayed
- Useful link (contains 4 parts) for adding a custom field to checkout & validating this field & saving this field to order fields & displaying the value of this field in order page: https://docs.woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/#section-7

How to filter a domain?

Is it possible to segment based on URL path?
Say I have one Google Analytics account with one created property (tied to abc.com). Depending on your login information, it will send you to abc.com/red, abc.com/blue or abc.com/yellow.
Is it possible to create separate views for /red, /blue and /yellow? How do you implement a custom filter for it?
Using Google Data Studio, how would you add a filter control to filter between /red, /blue and /yellow?
In your GA filter for the view choose :
predefined -> include only traffic to the subdirectories -> that are equal to -> /red/

tracking issues between two properties

I've set up Google Analytics account with two properties:
www.example.com
buy.example.com
Now I've created a custom dimension to be used as unique user ID (I am using cookie to assign unique ID to each website visitor)
Does it possible to generate report for my custom dimension cross domain? (so I can see ID data from www.example.com and buy.example.com in the same repot?)
when I've two properties can I set a goal between them?
Thanks
Shai
You need to only have one web property that you use on both sub-domains (www and buy).
Put the same tracking code on each.
You can then create two views, with a filter for www and buy sub-domains if you want to see them separately.
Your unique visitor counts etc. will all be cross sub-domain as you desire, and you can set Goals etc. according.

Drupal Views Content Profile User as an argument

I have a normal Drupal User. I have used the content_profile module to create a profile content type. This content type contains a node reference to another content type company. The company node then references a type of node called Task.
I want to create a view that list all the tasks for a given user id.
So I imagine I would create a view with an argument of user id. Then I would add the relationship to the profile and the company and output the Task title.
The user id used seems to work on the created used ID and not the user id of the content profile that it is referencing. In our system the "admin" user creates the profiles so it causing some problems.
Any ideas? I feel I may need to write a custom module to do what I want.
i have answered a similar question in the past about how to create a view using part of the url as an argument to filter the view by the user profile. check out this url. the answer you are looking for may be a variation of my original response.
also, how are you creating those profiles? on one of my sites, when i created the profile page, its author ID is automatically changed to the user it is associated with.

How do I get a twitter feed via a "username" query?

I currently have the following URL but it searchs for a keyword rather than just the users feed.
http://search.twitter.com/search.atom?q=from%3AUSERNAME
I want my users to be able to provide there username only and a feed be displayed on their profile.
What url should i use to obtain a users feed including old posts?
I think what you're looking for is:
http://twitter.com/statuses/user_timeline/%USERID%.rss
Where %USERID% is the ID of the user in question.
For example, the url to my own timeline is:
http://twitter.com/statuses/user_timeline/16979198.rss
with 16979198 being my user id number.
UPDATE
According to the Twitter API, you can also do the same with the users username as follows:
http://twitter.com/statuses/user_timeline/%USERNAME%.rss
Where %USERNAME% is the username of the person who's feed you'd like to view.
For example:
http://twitter.com/statuses/user_timeline/jamiedixon.rss
You can also replace the .rss portion of the link with other data types such as .json .atom
For further information on the Twitter API and Timelines, visit here:
http://apiwiki.twitter.com/Twitter-REST-API-Method%3A-statuses-user_timeline

Resources