Passing Queries on multiple across multiple pages - wordpress

When I generate a lead I get the values passed on via the URL Query which is the following:
?fname=[value]&lname=[value]&email=[value]
I’d like to know how I can carry this query over to the next page as well? (so the URL is passed over two pages instead of just the one).
So it would flow like this:
LeadPageExample.com -> Lead entered details -> LeadPageExample.com/Upsell?fname=Alex&lname=Smith&email=asmith#email.com -> Lead clicks on cancel or add to cart (I want fname=Alex&lname=Smith&email=asmith#email.com to be passed on again) -> LeadPageExample.com/checkout/?add-to-cart=312&fname=Alex&lname=Smith&email=asmith#email.com
Essentially I want the fname=Alex&lname=Smith&email=asmith#email.com query to be re-attached to the next link and passed on twice in this scenario.
To illustrate:
LeadPageExample.com/checkout/?add-to-cart=312&fname=Alex&lname=Smith&email=asmith#email.com
Any ideas? Is it possible? If so, how?
To be even more specific, I ONLY want this to happen on specific webpages on my wordpress site.
Thanks so much for the help.

Related

Generate and display html table with user data from wordpress

Update: With the help of the answerer below I figured out how to do this. Basically I used a WP Query to get users and their user metadata and I sorted and placed the data in a for each loop in a table.
I'm new to PHP and I need some help. Basically I want to create a leaderboard with different user data. I want to display it in an html table.
This is kinda what i want:
Username GamiPress Points Time since last login
And I want the table to be populated with these data amongst others automatically. I want two versions one that is sorted with the 15 users who have the most points and one that sorts on the 15 users that logged in last.
Can someone point me to the right place on how I can best implement this?
I basically want to create the GamiPress Leaderboard add-on that I, unfortunately, can't afford, but with some extra fields.
There are multiple steps to do if you want to achieve this:
1) Add meta field to your users, so you can store the points. For example you can use "Advanced Custom Fields" plugin for this.
2) Write a function for adding points to this field. Define when this function will be fired.
3) Query the users ordered by that meta value and display it (get_users($args) might be useful).
4) For the Last-Login value you can use a plugin (google Wordpress Last Login) and write another Query and order results by that meta field. You can also write this by your own, here is a link I found: https://www.wpbeginner.com/plugins/how-to-show-users-last-login-date-in-wordpress/
I don't know if this is what you were looking for.
Or did you want to see an example code how you use a wp query and display data in html table?

PageName segment in Adobe Analytics

I'm trying to create a segment based on this case:
"I have an event that is triggered in multriple pages and I only want to see the number of times it has been fired on a specific page."
I have created a segment where the condition is:
Page name (URL without domain) -> contains -> 'news/potatoe'
The problem with this is that when I cross this segment against the event, the results are wrong, I get very few hits even though I know, for sure, that the number of hits should be higher.
Adding on, when I breakdown a dimension by "Page name (URL without domain)", I don't get the total ocurrences.
Thank you in advance!
The pageName variable is kind of an outlier when it comes to event attribution. Instead of giving full credit to the page it fired on, it uses linear allocation, which divides credit equally among all pages seen in the visit. More info on linear allocation can be seen here:
https://marketing.adobe.com/resources/help/en_US/reference/allocate.html
In order to get the data you're looking for, you will want to use an eVar and not pageName. Using a processing rule to copy pageName into an eVar would be the easiest way to accomplish that.
In short, you're pulling the report right with the exception that pageName has weird attribution. If you replaced pageName with an eVar containing pageName data, you'd get the report you're looking for.

How to use cursors for navigating to previous pages using GQL and the new gcloud-java API?

I'm using the new gcloud-java API (https://github.com/GoogleCloudPlatform/gcloud-java/tree/master/gcloud-java-datastore/src/main/java/com/google/cloud/datastore) for working with the Cloud Datastore. My specific question is on using GQL for pagination with cursors. I was able to page through the results one page at a time in the forward direction using cursors, but not having any luck with paging backwards.
Example Scenario:
Let's say I've 20 entities in a Kind with IDs 1 through 20. I have a page size of 5. Once I'm on the 3rd page (IDs 11 through 15), if I need to go one page back; i.e. retrieve IDs 6 through 10, what would be the correct GQL/sample code? Again, I prefer not to use offset with a number, but would like to use Cursors.
From what I can tell (actually tested), it looks like one needs to keep track of Start/End cursors for each page as they navigate in the forward direction, then use the saved cursors when there is a need to go back. I just want to make sure if this is the correct/only way or there is a simpler way to accomplish this.
Thanks in advance for your help.
If you add to your original query a sort by key (appended to the end of your "order by" clause), you should be able to reverse each property's sort order and use the latest cursor from your original query to get results in reverse.
Suppose you've iterated through some of the values from your forward query's QueryResults. You can call QueryResults's cursorAfter() method, which will return a cursor pointing right after the last result you saw from your original query. Now you can issue a new query (with the opposite sort order on each property, including the key property) using that cursor as the start cursor. You'll probably want to skip the first result, since it will be the last result you saw from the original query.

Using filters to track hits for multiple URLs

We have a large website that is split up into groups of organisations with a number of micro-sites. We would like to provide one organisation within a group with their own set of data and I am having troubling getting the filtering working.
I think my main problem is I have 2 include filters. According to the documentation:
"If you apply multiple Include Filters, the hit must match every applied Include Filter in order to save the hit."
Our website urls would go something like this: https://[host]/[group]/[site]/[params]. I would like to track the following, given that this client (id 9) is in group "foo":
https://mysite.com/foo/live/default.aspx?id=9
https://mysite.com/foo/live/?id=9
https://mysite.com/foo/reporting/9/*
so that any hits on those urls would be captured for this particular client.
Our 2 current filters (type="Include") are as follows:
/foo/Reporting/9/
/foo/[^\?]*\?id=9
but these do not seem to track everything we think they should. Any help would be much appreciated.
By the time the first filter is done there is nothing left for the second filter to match - the first filter throws everything away that does not match (that's what Google means by "the hit must match every applied Include Filter").
I would suggest you first use an advanced filter to transform your urls so they follow all the same pattern (i.e. grab the value from the query parameter and append it to the url path) and then apply the include filter. I'm pretty certain that would be easier than trying to include different url structures (if you need help with the filters holler away in the comments, but the example given in the advanced filters interface should give you a clue how this works).

Update WordPress Posts Inside Loop

I have some processing inside my WordPress loop, and I want to "cache" the results so that the next time the post is displayed I can use the pre-processed info. The obvious place to store the results is as post metadata.
I have therefore incorporated a number of Update_post_meta calls into my code, along the following lines:
update_post_meta($imagePostID, "imageMeta", $imageMeta);
In this the value of $imagePostID is just the numeric Post ID, which I have already used to retrieve other metadata, so that's OK. I have also confirmed that the code is getting called at the right point.
However, the values are not getting saved, and it looks like for some reason the updates are just being ignored.
Does anyone understand why this is, and if there's any way to get the behaviour I want?
Thanks,
Andrew

Resources