I need to find out how to have a search bar that can find other pages on my site. Doing a google search, I can only find the code to create a search bar, and not utilise it. Its features would need to include auto correct and actually going to the page, basically these 2 things combined (https://www.w3schools.com/howto/howto_js_autocomplete.asp and https://www.w3schools.com/howto/howto_js_filter_lists.asp)
In the how to filter/search list example you can just add the urls to the corresponding links like <li>Adele</li>.
And in the how to js autocomplete example it will be a bit different and additional code needs to be written. If the url is the same as the items in the list there would not be an issue, but otherwise you need to make the array of countries into an array of objects so that each object will have the name of the country and the corresponding url. Then in the javascript function you will have to access the components as arr[x].country.
The array of countries should look something like this
`var countries = [{country:"Afghanistan", url:"afghanistan"}, {country:"Albania", url:"albania"},...}.
Then add an onClick event handler in the javascript function.
onClick="location.href=`www.example.com/${arr[x].url}`"
You can use Tipue search for that. It's easy and has many options. Like related links, search description, pagination.
It's very easy to customize, if you know how to use inspect element or javascript.
http://www.tipue.com/search/
I'm trying to figure out if there is a way to detect multiple custom HTML-5 attributes (i.e. "data-analytics-exp-name") and aggregate their values (with a delimiter) into a cookie using Adobe DTM without the user being involved (attributes only need to exist on the page and not be clicked on etc.).
I currently have a rule that reads a single custom HTML-5 attribute and performs
what I want using an event type of "element exists" and using:
var currExpName = this.getAttribute('data-analytics-exp-name');
but not sure how to approach for multiples at once?
If you're looking to get all attributes on the page, you will want to use something that can access the whole page. Try the following code:
`document.querySelectorAll("[data-analytics-exp-name]");
This should return all DOM elements containing the attribute data-analytics-exp-name. From there you can parse the array however you'd like to get the concatenated string you're looking for.
I'm looking for a solution that is similar to that asked by this question - namely I want to access the numerical information of each label and display it via a tooltip - see the example below:
The aggregate data (the number at the top of each date column) is compiled in the source jit.js, and I don't have access to it. I don't want to modify the source because it would take a lot of work and also prevent me from updating in the future without remodification. Does anyone know an easy way to access the data for each label? or perhaps the values of the previous and next nodes?
I am creating a webpage which requires a lot of dynamic interaction.
There can be two ways to go about it -
1. When a particular data comes in a particular tag, I add it to a javascript object and render it in html when the particular tag is clicked.
2. When a particular data comes in a particular tag, I create a dom structure ( div) with the data. The div is shown only when the user clicks on the tag
Which of the above two cases would give better performance when talking in terms of 100 tags and data coming in every 1-2 seconds....
Can there be any better way ?
I have a content driven website, where each content item belongs to many different categories.
For example, article "A" belongs to the categories "cat1", "cat3", "cat4" and article "B" belongs to the categories "cat2", "cat3", "cat4".
The number of categories is very big (around 800) and the number of articles more than 10.000.
I want to know all the pageviews of articles that belong to a given category.
Researching google analalytics I didnt find any tool that allows me to do that.
I investgated if I could misuse the campaigns to do it, but the only way would be to rewrite the urls (in order for the campaigns to work), and I dont want to touch my very nice urls.
I tried doing it with events, but it was messing up my bounce rate (since an event meant that the users were actually doing something, so the page was not counted as "bounced").
Has anyone any idea of what I could do to record my categories?
The same solution could be applied to tags in a blog post. (Lets say you wanted to know all the pageviews of all blog posts that have the tag "travel").
Thanks
Koyan
Ok, I didnt manage to do exactly what I wanted, but canibalising the custom fields I managed to do something very close.
I put in my ga code the following:
_gaq.push(['_setCustomVar', 1, 'Cat', '-coats-winter-red-used-light-pockets-', 3 ]);
Where coats, winter, red, used, light, pockets are the tags (categories) of that page.
I use php to produce this string.
An other page would have the following for example:
_gaq.push(['_setCustomVar', 1, 'Cat', '-dress-winter-blue-new-light-pockets-', 3 ]);
And all these got pushed to a single variable. Now, I cannot find which of the tags has the most hits (the one part of the report I wanted), but I can find how many hits a certain tag has.
To do that, I created a custom report, where I put the metric group "pageviews" and the Dimension drilldowns "Custom Variable (Key 1)", "Custom Variable (Key 1)
Custom Variable (Value 01)", "Page"
Then I run the report, click on the variable "Cat", and filter for -winter- and it gives me how manypageviews I had for articles with the tag "winter".
Dissadvantages:
a) There is a limit of 64 bytes for the combination of custom variable name and value. I have overcome this by not using actually the tags, but their id's
(so, in my real scenario, the values look like -31-39-45-130-168-206-249- but this is good enough for me).
b) You cannot find from inside google analytics which category/tag has the most pageviews.
(you can always export it though to a csv and work on it in an other script).
Hopefully Google will add a "tags" functionality sometime in the future (am I the only one needing this?)
One potential solution would be to use custom variables. For example:
Category1 = Coats
Category2 = Winter
Category3 = Red
The two limitations of this solution are that you are limited to five custom variables per page and that your google analytics queries would get fairly complex as you would need to search across all the category variables to find the specific value you're looking for.