google analytics - sending source and medium between chrome extension page -


i had created extension opens page 3 different methods:

  1. right click on image , clicking on menu item.
  2. link create dynamically on each image.
  3. upload image in background pop up.

once user clicks on link or uploads own image, new tab opened info of image clicked (or uploaded).

i had added utm_source , utm_campaign link reason, traffic counts direct traffic , doesn't add info analytics code.

example url: chrome-extension://leoaaeofnhfjkmghbdngecpnadnolnnj/index.html?utm_source=extension&utm_medium=upload#data:image/jpeg;base64,/9j/4aaqskzjrgabaqaaaqabaad/

other issue, tracking working correctly (sending pageview , events).

anyone experienced issue , have workaround?

after long investigation had found solution:

first, url params:

var url_string = window.location; var url = new url(url_string); var utm_source = url.searchparams.get("utm_source"); var utm_medium = url.searchparams.get("utm_medium"); 

then make sure count own domain referrer:

ga('create', 'ua-xxx-x', 'auto',{'alwayssendreferrer': true}); 

and set source , medium manually before calling page view event:

ga('set', 'campaignsource', utm_source); ga('set', 'campaignmedium', utm_medium); ga('send', 'pageview', '/xxx.html'); 

i'm guessing protocol chrome-extension:// utm params doesn't handle correctly , referral same domain (extension id) doesn't count referral.

hope someone...


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -