AddThis - contains too many device filters error

When using AddThis service with asp.net, some exceptions will throw like these:

The string 'fb:like:layout' contains too many device filters. There can be only one.

The string 'g:plusone:size' contains too many device filters. There can be only one.

You can solve this by using "In line server code".

 

Step 1: Implement the following code in your code file:

 

    Protected Function GetFacebookAttribute() As String
        Return String.Format("{0}=""{1}""", "fb:like:layout", "box_count")
    End Function
 
 
    Protected Function GetGooglePlusAttribute() As String
        Return String.Format("{0}=""{1}""", "g:plusone:size", "tall")
    End Function

 

Step 2: call it like this :

 

    <!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_floating_style addthis_counter_style" style="Right:0px;top:20px;">
<a class="addthis_button_facebook_like" <%=GetFacebookAttribute() %> ></a>
<a class="addthis_button_tweet" tw:count="vertical"></a>
<a class="addthis_button_google_plusone" <%=GetGooglePlusAttribute() %> ></a>
<a class="addthis_counter"></a>
</div>
<script type="text/javascript">    var addthis_config = { "data_track_addressbar": true };</script>
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-500fe1b1632c7311"></script>
<!-- AddThis Button END –>

 

 

 

Or you can call it directly without code file:

 

 

    <!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_floating_style addthis_counter_style" style="Right:0px;top:20px;">
<a class="addthis_button_facebook_like" <%=String.Format("{0}=""{1}""", "fb:like:layout", "box_count") %> ></a>
<a class="addthis_button_tweet" tw:count="vertical"></a>
<a class="addthis_button_google_plusone" <%=String.Format("{0}=""{1}""", "g:plusone:size", "tall") %> ></a>
<a class="addthis_counter"></a>
</div>
<script type="text/javascript">    var addthis_config = { "data_track_addressbar": true };</script>
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-500fe1b1632c7311"></script>
<!-- AddThis Button END –>

 

 

Hope that helps.

5 Comments

Comments have been disabled for this content.