Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
C0D4669446yJust embed it into the page. If it requires the user to allow for the use of it, then you’ll need to do a check prior to embedding the GA script into the page aswell.
Hopefully /page/user is a dynamic route so you would only have to add the check once in your code base but do the user check per relevant user. -
C0D4669446yOh wait, I so read that wrong
If you are using a cms of some kind then yes you should be able to allow the user to add their GA ID only as part of their pages fields (prevent xss) and you inject the GA script into their page using their ID on /username lookup. -
@C0D4 thanks, I want the user to view the analytics for that page in my application from their GA dashboard, would that be possible. I haven't used GA this my first time and I'm trying to understand as I go!
-
C0D4669446y@cha-m-ra
So I don’t know about what you’re trying to implement this into.
But at a high level.
- Add a field to dbs for GA Id
- check if user (relevant to page) has stored a value
- I don’t think you can actually validate a GA Id (I could be wrong)
- on the /username/user page embed the Ga script with the users GA Id
- create a plugin for.. lavarel (based on your profile)
- profit $$$ -
@C0D4 does GA script only need the ID? won't it ask for the API keys and secret key?
-
C0D4669446y@cha-m-ra if it’s only analytics then no, only the ID, but if I remember correctly, you’ll need to use the cross domain tracker.
Most other Google services require the secret keys though.
Related Rants
Is there a way to implement Google analytics to a specific page.
So, my requirement is to let the user add his/her Google analytics to their page on my application. The page is in sub-route of the application (user/username)
Can I allow a user to do that? Are there any articles related to this?
question
google analytics