Custom variables in Google Analytics - asp.net-mvc-4

I have an application in which I am displaying dynamic advertisements. There are some ads displayed on pages without logging in, and others on pages that you have to log in to access them.
First, I want to be able to track how many clicks have been made on a given ad accessible anonymously.
I added this code to the onclick event of the ad
onclick="ga('set', 'dimension1', '#item.Id')" // #item.Id is the Id of the Ad
I can see that the event is triggered in the GA Debugger in Chrome, but I cannot see the result in GA even after 24h.
Second, I want to be able to track the Ids of the users who have clicked on the a given ad. And I don't know if this can be done using GA.
An ideas ?

Custom Dimensions and Metrics are necessarily connected to an interaction and cannot be sent on their own - they must always be followed by an interaction hit (pageview, event, transaction etc).

Related

GA4 Purchase Event duplicate

We are running GA4 measurements with GTM embedded in our Shopify store.
It is generally working fine, but the purchase event is occasionally firing in duplicate.
I checked the search report and found several pages with 2 purchase events and 1 display count. (Not all, but only some of them.)
We created a test environment and ran the operation several times, but the same phenomenon did not occur.
I think that GTM is probably sending the purchase event twice, but I have no idea why this is happening.
I have written the js to send the event as window.dataLayer.push and send it only once on the page.
I would appreciate any information you can give me if you are having similar problems or if you have solved the problem.
Thank you in advance.
Having similar issue in Shopify Plus store. Not only purchase, but events view_item , add_to_cart are triggered twice. This view_item marked 34 on screenshot event is gtag event pushed to datalayer automatically , at the same time event view_item marked 36 is my datalayer push
Tried to investigate why is it pushed automatically and found this push in Console .Seems these duplicating events are connected with Google Shopping App conversion events because when I compared conversion labels of them in my Google Ads account , they were the same as in Tag Assistant extension and in Google Ads account (last picture contains begin_checkout event label, view_item conversion was deleted)
This app is called Feed for Google Shopping if you search in your Shopify admin or also its site is https://gsf.simprosysapps.com/.
Also tried to Deactivate in this Google shopping app Google ads conversion tracking tag but it does not help. Now I am trying to find a way how to turn off these conversion events and get rid of these pushes. Maybe if there will be possibility just to rename them, they will not double in GA4 property.

How to remove sign-in restriction from Google Form programmatically?

I am creating Google Forms programmatically with a Google Script project.
DriveApp is used to grant view access to anyone with a link.
var form = FormApp.create("Test form");
var formFile = DriveApp.getFileById(form.getId());
formFile.setSharing(DriveApp.Access.ANYONE_WITH_LINK, DriveApp.Permission.VIEW);
However the Form still requires "anyone" to sign-in and it's restricted to my G Suite domain users. I've tried to find how to disable this but I don't know how the feature is even called in Google Scripts.
See the attached image with a checked box:
Note: I can disable the sign-in requirement manually. But Forms are delivered to respondents automatically and there's no time to do this manual step.
I haven't had to do this, so I'm not sure if it's what you need, but have you tried using the setRequireLogin(requireLogin) method when creating your forms?
See https://developers.google.com/apps-script/reference/forms/form#setRequireLogin(Boolean)

Timeline app appears only if page is currently liked

This is the first Facebook App i've created since the Timeline changes. Everything appears to be working the same, except for adding the app to my page's Timeline "Favorites"(?) (the boxes at the top near the About section). A large majority of the traffic to this app will come from visitors seeing the app tab on our page.
I'm attempting to add it using the following URL:
http://www.facebook.com/dialog/pagetab?app_id=MYAPPID&redirect_uri=MYAPPURL
Then I select the page, and click "Add Page Tab".
This works fine - I can then swap it's position, view the app, edit settings, etc.
I set up the tab how I want it, and then log out and visit my Facebook Page directly to view the app tab as a visitor would. The app is no longer there. Log back in, everything is fine, log back out, it's gone. It appears that if you do not already Like the page, you cannot see the app. If you do like the page, you can see it. I'd like the app to be viewable by people who do not like the page as well, as the app has a fan gate of it's own.
I've disabled Sandbox mode as well so i'm not sure what's left to do.
Any help is appreciated.
You mentioned in the comments that the app is restricted to US users:
Because your app is restricted, it won't be displayed to logged-out browsers - this is expected because unless the user is logged-in, their location and age can't be determined in order to check the restrictions you've set
If you must have the app visible to logged-out users, remove the API-level restriction and use the details passed in the signed_request to show or hide the app's content
{edit} I missed the edit to your question {/edit} - it may also be that your existing signed_request processing code is failing for logged out users

How to detect if user has switched Rails 3

A user logs into my application in a tab in a browser
They get an email and click a link which opens a new tab in the same browser and logs them in under a different email say.
If they go back to the first tab they are no longer the same user and I want the page to automatically detect this and then reload or redirect them if they are unauthorized to view the page.
Anyway to do this?
Or, if you really want to know when user is switched the tab, try this library:
visibility.js
As stated by #Hck:
add javascript code to reload page periodically (for example once per 30 seconds) – Hck
JavaScript is pretty much the only way to make pages do stuff after they're loaded. Note that in pretty much any user authentication system, a given browser will only be logged in as one user at a time, so as soon as the second tab opens, that browser will be acting as the second user - they can still see the current content of the first tab, but links (for instance) will no longer work unless the second user was also authorized to use them.
There are some JQuery plugins that do this sort of thing, like PeriodicalUpdater, or you can write your own (an example).

Custom click tracking for adsense

I need to identify my users when an ad is clicked. For example, when user A is online, I need to know that he was the one who clicked the ad unit.
When using my own ads, this was a piece of cake (using URL redirection) - however, now we are planning to switch to Adsense - which renders the Ad via javascript - hence I cannot setup a redirection there.
How do I track - which user which ad unit - in case of adsense?
Thanks alot.
--
Maku
This should help - http://blog.openx.org/01/google-adsense-click-tracking-integration/