How should we use google analytic script in django? - html

Can we add google analytic script in tag and push it to the GitHub or we should keep it secret i.e. add it to the .env file and call in .
When I tried by the second one it appears in the source page as it is and also not working properly.

I would say there is no meaning of hiding it because it is also shown when 'view page source' is clicked. All you need is a simple filter. It will only include traffic on your domain, protecting yourself from any data corruption when people hijack your Google Analytics Property ID.
To find your filters:
Go to your Google Analytics standard reports
Click on the “Admin” button in the top right
Click on “Filters”
Click “+ New Filter
Then use these settings for your filter:
Select “Create New filter for Profile”
Name your filter with something snazzy like “Hacking Defense”
Select “Custom Filter”
Select “Include”
For the Filter Field, select “Hostname”
If your site is LarsLofgren.com, you would define the filter pattern
as “larslofgren.com” and make sure to include a “\” before any “.”
Pick “No” for case-sensitive

At the end of the day, your analytics id will be visible on your website. So, I don't think you should make an effort to hide it.
Just add it to your base template and you should be ready to go :)

Related

Dropdown select with delete option next to each option value

I need to implement a drop-down which has a delete 'X' option next to each option item. Somewhat like the image shown below.
The drop-down is populated dynamically and I need a way that does not inlvolve using list as an alternative.
EDIT: The icons next to each dropdown item refers to 'Edit'/'Delete'
You cannot put a checkbox into the usual <select> or multi-select HTML element.
However, here is another question where several good options are discussed.
This looks like the most useful and best suited to your purpose:
https://stackoverflow.com/a/27547021/1447509
And here is an example of how to change the default checkmark to an X:
https://stackoverflow.com/a/40123793/1447509
Sources:
How to use Checkbox inside Select Option
After selecting check box Instead of Tick symbol need X in html
UPDATE:
Given that you need both the HTML markup and the javascript to make it do what you want, you have two (possibly 3) steps to do:
This answer provides a good example of how to create the custom-rolled <select> control.
This answer shows you how to replace the checkbox created in step 1 with an icon/image of your choosing.
The javascript to remove the x'd <option> is very simple:
$(this).closest('option').remove();
IF you also need to save these results, then you also need to learn:
4a. Server-side SESSIONS (so that each user's customizations are saved for them)
4b. A login system, so you know for which user to save the current customizations.
4c. Just the basics of how to use a back-end database, such as MySQL/MariaDB, in which to store the user customizations.
4d. AJAX - so you can schlep info to the back-end for insertion into the database without refreshing (or navigating away from) the current page. AJAX replaces the ancient and no-longer-used <form> construct. Frankly, once you've used AJAX a couple of times, you'll never go back. Totally easy.
If you are in a bind and need someone to create the whole thing for you, I refer you to one of these websites - I have used such services myself and can recommend them.

Automatically update embedded Google Sheets Chart in Docs?

I have inserted a chart into a Google Doc, but would like to make it update automatically instead of having to manually open the Doc and press the floating update buttons.
So far I have found no way to do this beyond writing a script to replace each one every time - which I have not yet felt strong enough to do.
How can an embedded chart be updated automatically?
Google Docs doesn't support the proper way of linking and embedding objects like MS Office does. I haven't seen any real solution as yet.
I found several answers from this forum you might want to try:
Using XML Gadget for Charting:Steps if you would like to try out;
Go to your google spreadsheet (or googgle form data).
go to Menu>Insert>Gadget
click "chart" & select chart you like & "add to spreadsheet"
key-in all the chart setting required by the Gadget
click "apply & close"
After the chart populated, point your mouse to the left corner of chart, click "gadget"
You'll see "Get Query data source"-item a
and "Get XML" - item b
click the item b, example "http://www.google.com/ig/modules/image-bar-chart.xml"
Go to google "site" and "insert" > "more gadget"> "add gadget by url"> paste the item b, http://www.google.com/ig/modules/image-bar-chart.xml
You'll need to provide the data source in the pop-up windows, paste the link of item a and key-in all necessary setting. (refresh interval 1, 5, 30mins- set here)
save & done.
Using ARRAYFORMULA to make sure that the charts would be updated with the new information. Sample is in this site.
I'm not entirely sure if this is useful but since you're doing scripting, you might as well check Read and write data in Firebase from Apps Script.
Found a hint at github:
Yes, that is correct, published charts in Google Sheets only update 5 minutes after a change was made.

Check that a link has been clicked

I would like to keep track of how many times a certain link in Google Spreadsheets has been clicked. I have been searching but I can't seem to be able to find how to check whether a link has been clicked or if it is possible to attach onclick event on a link.
A quick solution is to use the Google URL shorten service for the links. This page gives you the number of clicks per link.
its not possible, you cant detect cell or link clicks.
Two possibilities here:
One way is to have a server (or an apps script service) be the link "proxy" and redirect to the final site as in:
script.google.com/.../exec?url=myurl.com
your script tallies the hit and then redirects the user. redirecting without an extra click might not be possible with apps script htmlService but its possible on your own server.
you can make the urls look pretty by using =hyperlink in the cells so users dont see the long url (until click)
Another way if you have control of the links you are pointing to is to use analytics on those pages. You can use the referer to tally views that came from a spreadsheet click, or you can explicitly add parameters to each url so that youcan later filter those comming from your sheet.

Buttons for Filter Views

I'm trying to prepare a large contact sheet on the new Google Sheets.
I want to be able to quickly filter through the data (7-8 presets).
I was initially setting this up on Excel using Slicers, which did the job quite well.
The Filter Views work pretty well for what I want, but I want it to show in the form of buttons showing up on the spreadsheet. Is there a Macro I can write to do this? Is there an API open that can access switching on and off of filter views?
If yes, that will do the job perfectly. If not, Can I call filters and not filter views somehow? And hardcode the filter conditions into the macro buttons?
In Short : I want toggle buttons to turn on/off all Filter Views.
Please drop in your suggestions about other alternatives to do this
Although this is an old question, I thought I'd share my solution:
Create a filter view, and look at the browser address bar. You'll see the URL for the filter view eg:
https://docs.google.com/spreadsheets/d/1vq6yK7m3HxxxxxxxxxxxxxxxxxQyv3ASdA/edit#gid=10999999999999948&fvid=2049999999922
Note the numbers after #gid and &fvid which refer to the google sheet and filter view ID respectively.
Go to a cell within the spreadsheet and enter the formula:
=hyperlink("https://docs.google.com/spreadsheets/d/1vq6yK7m3HxxxxxxxxxxxxxxxxxQyv3ASdA/edit#gid=10999999999999948&fvid=2049999999922", "Name of the filter view")
The cell will show the familiar blue underlined "Name of the filter view" and clicking on it will show the filter view.

How to set focus on tab in tabcontrol in URL

I am trying to call a page in my customers webapplication (Exact Synergy Enterprise)
This is the link: http://someserveridontdisclose/Synergy/docs/CSCANEduCourseCard.aspx?ProjectNr=ACPGINTV
Within this page is an Ajax TabContainer with several TabPanels. One of them is called 'Doelgroepen'
I dont have the source for this application, as i am not the developer of it. We only develop custom extentions to it.
Here's the question: Is it possible to focus on one of the tabs USING ONLY AN URL? If so How?
Thank you very much for your thoughts about this.
try to set with javascript. you'll have to write your own js to get index number you want from url, then set like this
$find('<%=TabContainer1.ClientID%>').set_activeTabIndex(2);
http://forums.asp.net/t/1127834.aspx
http://www.aspforums.net/Threads/420684/ASPNet-AJAX-TabContainer-Set-Active-Tab-Client-side-using-JavaScript/
If you do not have access to the code and if this is not part of the requirement / design specification for the application you are using (ie: what you asked the developer to do), then the answer is No.
The control does not have "native" support for URL tab selection. There needs to be specific code in the application in order to handle this.
It is however very easy to implement, if you absolutely need it, it shouldn't take much time (about 15-30 lines of code, depending on how many tabs/urls combination you need).
You can find a running sample of the AjaxControlToolkit Tabs control at the following link (the available functionnalities are described in there):
http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/Tabs/Tabs.aspx
If the TAB has an ID you could make it visible by adding '#tabid' to the URL.