Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document primary-key integration #56

Closed
mrspartak opened this issue Jul 3, 2020 · 5 comments
Closed

Document primary-key integration #56

mrspartak opened this issue Jul 3, 2020 · 5 comments

Comments

@mrspartak
Copy link

Readme page says that I can associate visitors in Shynet with their user accounts on my site. But how? I can't find any clue to this.

@milesmcc milesmcc changed the title Primary-key integration Document primary-key integration Jul 3, 2020
@milesmcc
Copy link
Owner

milesmcc commented Jul 3, 2020

You're right, I'm surprised this is not well documented. I'll leave this issue open until I add it to the docs.

In the meantime, here's how you do it: add the 'primary key' to the URL you load the tracking script from. So for example, if your Shynet script location (for either the pixel or the script) is //shynet.example.com/ingress/your_service_uuid/pixel.gif and //shynet.example.com/ingress/your_service_uuid/script.js, you'd add the primary key as an additional path between the service uuid and the resource, like so: //shynet.example.com/ingress/your_service_uuid/the_primary_key/pixel.gif` and //shynet.example.com/ingress/your_service_uuid/the_primary_key/script.js`.

@mrspartak
Copy link
Author

I guess it would be much better to implement it also inside client API, because of SPA websites

@mrspartak
Copy link
Author

Hi! But this is still not a solution for SPA. I guess using something like Shynet.PRIMARY_KEY = 2 on a client and then building an URL could solve this

@milesmcc
Copy link
Owner

milesmcc commented Jul 7, 2020

It also works for SPAs, no? All you need to do is dynamically generate the script URL using JavaScript.

@mrspartak
Copy link
Author

The user could be logged out, and when it logs in, I have no options to generate any links. Also, I never saw "analytics" front-end script, that asks to generate its link. All setup is done after it's loading via API.
We have apps that are getting current user information after loading. Also, they are entirely HTML without any backend rendering. That is one of the points of SPA after all.
I'm using Vue/Nuxt FYI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants