Our site has an odd GA set up with two different GA codes, 1 for desktop, another for mobile. (We use dynamic serving of website code to send different code based on User agent.)
Now we have a blog on sub domain, and as it has it's own GA code, we cannot attribute channel traffic from the blog to the main site, it just comes in as referral.
To set up correct attribution from a sub domain you need to use the same GA codes, however, as the Wordpress blog is responsive, I cannot easily ad two different codes based on device type.
Is there a plugin, or a way to serve different code based on device?
Our site has an odd GA set up with two different GA codes, 1 for desktop, another for mobile. (We use dynamic serving of website code to send different code based on User agent.)
Now we have a blog on sub domain, and as it has it's own GA code, we cannot attribute channel traffic from the blog to the main site, it just comes in as referral.
To set up correct attribution from a sub domain you need to use the same GA codes, however, as the Wordpress blog is responsive, I cannot easily ad two different codes based on device type.
Is there a plugin, or a way to serve different code based on device?
Share Improve this question asked Nov 29, 2019 at 5:47 moobotmoobot 1581 gold badge2 silver badges9 bronze badges 1- You could use a library like mobile-detect: hgoebl.github.io/mobile-detect.js . Set a variable like ‚var your_prefix__gaid = ...;’ depending on device and put that var into you GA code. It‘s not 100% reliable but pretty much I guess. – Luckyfella Commented Nov 29, 2019 at 7:50
1 Answer
Reset to default 0The interesting question is: how are the analytics codes inserted? If it is inserted by a "google analytics" plugin, you won't have that much luck.
If it is inserted directly into the theme files, you can change the Code to send a "custom session dimension" to send the information, which type of device is used, to google analytics.
You can read more about custom dimensions here:
https://support.google/analytics/answer/2709829?hl=en
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744957039a4603255.html
评论列表(0条)