Updated: Comment #13
Problem/Motivation
The widget js would be loaded but now analytics would come through to addthis.com.
The problem is a invalide url to the widget.js. It was ending with addthis_widget.js#pubid=012345?async=1 while it should be addthis_widget.js#pubid=012345&async=1. Besides that it is including the widget.js after the DOM is ready.
Proposed resolution
Fixing the url structure and adding the domready type of loading and simple include through the UI.
Remaining tasks
Nothing.
User interface changes
Adds a new configuration option to the Advanced Settings tab for AddThis.
API changes
No API changes.
Original report by walangitan
I'm having trouble getting analytics to register on addthis.com
Checking the script like they suggest by typing addthis_config.pubid to see if it matches to the profile ID for the site results in an "undefined" for me and I can't figure out how to fix this.
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | 1919156-13.patch | 6.5 KB | matglas86 |
| #13 | interdiff.txt | 1.83 KB | matglas86 |
Comments
Comment #1
leon kessler commentedI've got the same problem, think maybe the addthis API has changed.
I got it to work by going to admin/config/user-interface/addthis/advanced and enabling advanced configuration.
I copied everything currently from my addthis_config and added pubid
(Can't confirm it's 100% working yet as no reports have come through, but my email template is which means it's picking up the account at least).
Looking into the module, think the problem might be within addConfigurationOptionsJs() in classes/AddThis.php, the configuration array in this file doesn't include the profile.
Comment #2
khalib commentedWhat's breaking the analytics is that the JS that the module is outputting appends a query param. Since the AddThis JS path has the account ID after a hashtag, the string being appended causes the AddThis account ID to be invalid:
"addthis":{"widget_url":"http:\/\/s7.addthis.com\/js\/300\/addthis_widget.js#pubid=ra-51c1ed312e03e156?async=1"}
AddThis is reading the JS call with the ID of: pubid=ra-51c1ed312e03e156?async=1
as suppose to: pubid=ra-51c1ed312e03e156
Comment #3
icdq commentedsame problem for me, any possibility to fix?
Comment #4
kyawzayl commentedSame here as well. Analytics data are not showing in addthis account. Any fixes?? Thanks.
Comment #5
jtherkel commentedIs this as simple as commenting out line 196 of addthis/classes/AddThis.php? (I'm just guessing.) I just tried this on my Dev site, and I'll report back if it works.
Unfortunately, it will take around 24 hours because my Dev site is on a different domain from Production. AddThis takes a little while to recognize a new subdomain (more below).
If you're brave enough to try this on your Prod site, log into AddThis and view data for the 24 hour period. Here are some relevant links and quotes from the AddThis support site.
Data Freshness
"Reports that use the 24-hour view will update every 5 minutes and will contain data as recent as 10-20 minutes ago. Reports for daily periods like 'last week' will update nightly, at approximately midnight eastern time, and may take up to 24 hours to appear."
http://support.addthis.com/customer/portal/articles/381258-data-freshnes...
AddThis Account for multiple websites
"New domains can take about 24 hours to show up from the first time they're shared."
http://support.addthis.com/customer/portal/questions/262636-add-this-acc...
Here's the command I used to search my source code for the relevant file.
grep -i -r "async" sites/all/modules/contrib/addthis/Comment #6
dijup tuladhar commentedHi JT,
Did it worked for you?
I am having same problem with the module there is nothing my analytic page. Is there any way to check the debug the setting?
Please let me know if it works for you.
Thank you,
Dijup
Comment #7
jtherkel commentedSorry Dijup, it did not work for me. I would have posted here sooner if I had achieved success. :) It's a little tricky to change some code and wait 24 hours to see if it worked.
Comment #8
hawkeye.twolfHi, John.
You were on the right track. I don't know what the "is widget js async" variable does, but it doesn't actually get set anywhere in the AddThis module code, so it always uses the default value (TRUE). Changing it to FALSE causes that function to load the JS file directly from AddThis.com, which correctly loads the dependent JS files as well. I'm guessing that variable is a legacy of older AddThis API integration and perhaps we no longer need it.
A patch is attached, and it works for me. Also note that the AddThis analytics picked up my new domain almost instantly; it didn't take the full 24 hours.
Cheers,
Derek
Comment #9
nico.knaepen commentedHi Derek,
There's no need to write in the AddThis.php class because this can be easily fixed by setting a variable
variable_set('addthis_widget_async',FALSE);The variable_set can be done in a custom module update hook.
Regards,
Nico
Comment #10
matglas86 commentedComment #11
matglas86 commentedComment #12
matglas86 commentedIt came down to two problems. One the url for the widget was incorrect. It contained a ? instead of a & sign. And the async method requires that the addthis is loaded at rendering and triggers a init() after everything is loaded.
Now I fixed several things.
What is still left to do.
You can download this version of the module here.
https://github.com/matglas/addthis/archive/issues/1919156-no-tracking.zip
This is the patch seen on github.
https://github.com/matglas/addthis/compare/7.x-4.x...issues%2F1919156-no...
Comment #13
matglas86 commentedIn my last patch I made 'domread' the default but for consistency reasons with past versions I thought it woulde be good to make async the default.
Besides that I moved the loading of the widget script to the footer. This is only applicable to 'async' and 'include' type loading.
There are now three types of widget js loading.
Comment #14
matglas86 commentedRe-roll against head of 7.x-4.x
Comment #15
matglas86 commentedIf I don't receive feedback in the coming week I'm going to apply the patch and close the issue. I want to make some progress on the issues.
Comment #16
matglas86 commentedFixed this issue. If any problems arise please reopen a new issue with a reference to this one.
Commit: 68aa4